@@ -13,7 +13,7 @@ use warnings;
1313use strict;
1414use Config;
1515# plan tests => 134;
16- plan tests => 100 ;
16+ plan tests => 96 ;
1717
1818our $TODO ;
1919
@@ -59,16 +59,16 @@ is($foo, 4, 'second escape while loop');
5959my $r = run_perl(prog => ' goto foo;' , stderr => 1);
6060like($r , qr / label/ , ' cant find label' );
6161
62- my $ok = 0;
62+ my $thisok = 0;
6363sub foo {
6464 goto bar;
6565 return ;
6666bar:
67- $ok = 1;
67+ $thisok = 1;
6868}
6969
7070&foo;
71- ok($ok , ' goto in sub' );
71+ ok($thisok , ' goto in sub' );
7272
7373sub bar {
7474 my $x = ' bypass' ;
@@ -139,7 +139,7 @@ FORL2: for($y=1; 1;) {
139139
140140# Does goto work correctly within a try block?
141141# (BUG ID 20000313.004) - [perl #2359]
142- $ok = 0;
142+ my $ok = 0;
143143eval {
144144 my $variable = 1;
145145 goto LABEL20;
@@ -208,65 +208,6 @@ ok($ok, 'works correctly in a nested eval string');
208208 $deprecated = 0;
209209}
210210
211- # bug #9990 - don't prematurely free the CV we're &going to.
212-
213- sub f1 {
214- my $x ;
215- goto sub { $x =0; ok(1," don't prematurely free CV\n " ) }
216- }
217- f1();
218-
219- # bug #99850, which is similar - freeing the subroutine we are about to
220- # go(in)to during a FREETMPS call should not crash perl.
221-
222- package _99850 {
223- sub reftype{}
224- DESTROY { undef &reftype }
225- eval { sub { my $guard = bless []; goto &reftype }-> () };
226- }
227- like $@ , qr / ^Goto undefined subroutine &_99850::reftype at / ,
228- ' goto &foo undefining &foo on sub cleanup' ;
229-
230- # When croaking after discovering that the new CV you're about to goto is
231- # undef, make sure that the old CV isn't doubly freed.
232-
233- package Do_undef {
234- my $count ;
235-
236- # creating a new closure here encourages any prematurely freed
237- # CV to be reallocated
238- sub DESTROY { undef &undef_sub; my $x = sub { $count } }
239-
240- sub f {
241- $count ++;
242- my $guard = bless []; # trigger DESTROY during goto
243- *undef_sub = sub {};
244- goto &undef_sub
245- }
246-
247- for (1..10) {
248- eval { f() };
249- }
250- ::is($count , 10, " goto undef_sub safe" );
251- }
252-
253- # make sure that nothing nasty happens if the old CV is freed while
254- # goto'ing
255-
256- package Free_cv {
257- my $results ;
258- sub f {
259- no warnings ' redefine' ;
260- *f = sub {};
261- goto &g;
262- }
263- sub g { $results = " (@_ )" }
264-
265- f(1,2,3);
266- ::is($results , " (1 2 3)" , " Free_cv" );
267- }
268-
269-
270211# bug #22181 - this used to coredump or make $x undefined, due to
271212# erroneous popping of the inner BLOCK context
272213
0 commit comments