This code SEGVed in a cpan/ module while I was messing with pp_goto.
Add it to t/op/goto.t so that it can SEGV there instead.
use warnings;
use strict;
-plan tests => 97;
+plan tests => 98;
our $TODO;
my $deprecated = 0;
::is($count, 10, "goto undef_sub safe");
}
+# make sure that nothing nasty happens if the old CV is freed while
+# goto'ing
+
+package Free_cv {
+ my $results;
+ sub f {
+ no warnings 'redefine';
+ *f = sub {};
+ goto &g;
+ }
+ sub g { $results = "(@_)" }
+
+ f(1,2,3);
+ ::is($results, "(1 2 3)", "Free_cv");
+}
+
# bug #22181 - this used to coredump or make $x undefined, due to
# erroneous popping of the inner BLOCK context