Bob Rogers <[EMAIL PROTECTED]> wrote:
    From: Leopold Toetsch <[EMAIL PROTECTED]>
   Date: Mon, 18 Sep 2006 11:53:36 +0200

   Am Montag, 18. September 2006 03:56 schrieb Bob Rogers:
   >    The attached patch consolidates most of the existing stack-unwinding
   > code into Continuation:invoke; previously, RetContinuation:invoke and
   > find_exception_handler also did stack-unwinding, and none of the three
   > did it quite the same way.

   Very good.

Thanks.

Unfortunately, this patch breaks Tcl. There seems to be some bug with
exceptions.

Here's the Tcl used for this example:

   proc test {} {uplevel #0 {append}}
   test

[uplevel] executes its argument in another scope. In this case, it's
executing [append] in the global scope. This [append] call will throw
an exception because it hasn't passed enough arguments. [uplevel]
catches the exception so it can restore the call stack and then
rethrows the exception.

The code for this can be found in
languages/tcl/runtime/builtin/uplevel.pir (the actual catch happens on
line 68). The .catch() and .rethrow() macros are defined in
languages/tcl/src/macros.pir.

What's actually happening when I run this code is that the [uplevel]
code restores the call stack and rethrows the exception... and then
somehow catches it again (this is the bug), which causes a
ResizablePMCArray "can't pop from empty array" error.

I tried to write up a small test case demonstrating what the problem
was, but none of my guesses of what's causing it were correct. I hope
I've given you enough information to fix it. If I haven't, let me know
what else I can provide.

Thanks,

--
Matt Diephouse
http://matt.diephouse.com

Reply via email to