Author: chromatic
Date: Sun Mar 30 23:29:02 2008
New Revision: 26658

Modified:
   trunk/compilers/imcc/parser_util.c
   trunk/t/op/01-parse_ops.t

Log:
[IMCC] Fixed a segfault when parsing a yield outside of a coroutine (reported
by Seneca Cunningham, RT #52220).

Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c  (original)
+++ trunk/compilers/imcc/parser_util.c  Sun Mar 30 23:29:02 2008
@@ -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;
     }

Modified: trunk/t/op/01-parse_ops.t
==============================================================================
--- trunk/t/op/01-parse_ops.t   (original)
+++ trunk/t/op/01-parse_ops.t   Sun Mar 30 23:29:02 2008
@@ -1,5 +1,5 @@
 #! perl
-# Copyright (C) 2006-2007, The Perl Foundation.
+# Copyright (C) 2006-2008, The Perl Foundation.
 # $Id$
 
 use strict;
@@ -89,6 +89,8 @@
     $cmds{$basename}{ $op->full_name . ' ' . $args }++;
 }
 
+$ENV{TEST_PROG_ARGS} ||= '';
+
 plan skip_all => 'IMCC cannot do parse-only with JIT enabled'
     if $ENV{TEST_PROG_ARGS} =~ /-j/;
 

Reply via email to