summaryrefslogtreecommitdiff
path: root/t/op/goto.t
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2005-05-04 14:01:40 +0000
committerDave Mitchell <davem@fdisolutions.com>2005-05-04 14:01:40 +0000
commit3a1b2b9e42aa284970a0868f88d8857a18a0a3b9 (patch)
treeae1e14bb75b2223e5071c231a860306c969335c0 /t/op/goto.t
parent304dea91bf747b5b240c3ec3a6a4dfebeab12289 (diff)
downloadperl-3a1b2b9e42aa284970a0868f88d8857a18a0a3b9.tar.gz
[perl #35214] SEGV when next is followed by a goto
next and redo didn't restore PL_curcop p4raw-id: //depot/perl@24384
Diffstat (limited to 't/op/goto.t')
-rwxr-xr-xt/op/goto.t24
1 files changed, 23 insertions, 1 deletions
diff --git a/t/op/goto.t b/t/op/goto.t
index 3b921238f2..806dbed674 100755
--- a/t/op/goto.t
+++ b/t/op/goto.t
@@ -7,7 +7,7 @@ BEGIN {
@INC = qw(. ../lib);
}
-print "1..47\n";
+print "1..49\n";
require "test.pl";
@@ -414,5 +414,27 @@ sub b32039 { goto &c32039; }
sub c32039 { print $_[0] eq 'foo' ? "" : "not ", "ok 47 - chained &goto\n" }
a32039();
+# [perl #35214] next and redo re-entered the loop with the wrong cop,
+# causing a subsequent goto to crash
+
+{
+ my $r = runperl(
+ stderr => 1,
+ prog =>
+'for ($_=0;$_<3;$_++){A: if($_==1){next} if($_==2){$_++;goto A}}print qq(ok)'
+ );
+ $r =~ s/\n//g;
+ print "# r=$r\nnot " unless $r eq 'ok';
+ print "ok 48 - next and goto\n";
+
+ $r = runperl(
+ stderr => 1,
+ prog =>
+'for ($_=0;$_<3;$_++){A: if($_==1){$_++;redo} if($_==2){$_++;goto A}}print qq(ok)'
+ );
+ $r =~ s/\n//g;
+ print "# r=$r\nnot " unless $r eq 'ok';
+ print "ok 49 - redo and goto\n";
+}