[PATCH #2] Re: [perl #22181] goto undefines my() variables
[p5sagit/p5-mst-13.2.git] / t / op / goto.t
index 5b30dc5..8a39d9a 100755 (executable)
@@ -2,7 +2,7 @@
 
 # "This IS structured code.  It's just randomly structured."
 
-print "1..28\n";
+print "1..29\n";
 
 while ($?) {
     $foo = 1;
@@ -185,6 +185,17 @@ sub f1 {
 }
 f1();
 
+# bug #22181 - this used to coredump or make $x undefined, due to
+# erroneous popping of the inner BLOCK context
+
+for ($i=0; $i<2; $i++) {
+    my $x = 1;
+    goto LABEL29;
+    LABEL29:
+    print "not " if !defined $x || $x != 1;
+}
+print "ok 29 - goto in for(;;) with continuation\n";
+
 exit;
 
 bypass: