On Saturday 29 March 2008 06:50:51 jerry gay wrote:

> the contents of t/op/01-parse_ops_335.pasm should be somewhere between
> 2 and 12 lines. could you paste it inline? it would help us find the
> op(s) causing the segfault.

The code is:

        end
        yield

... and it crashes because there's no coroutine from which to yield.

The attached patch fixes this (in IMCC, sigh).  Is there a cleaner way?

I'll apply it unless I hear objections.

-- c

=== compilers/imcc/parser_util.c
==================================================================
--- compilers/imcc/parser_util.c	(revision 26615)
+++ compilers/imcc/parser_util.c	(local)
@@ -746,6 +746,10 @@
         PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG);
     }
     else if (STREQ(name, "yield")) {
+        if (!IMCC_INFO(interp)->cur_unit->instructions->symregs[0])
+            IMCC_fataly(interp, E_SyntaxError,
+                "Cannot yield from non-continuation\n");
+
         IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->pcc_sub->calls_a_sub
             |= 1 | ITPCCYIELD;
     }

Reply via email to