In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/00bc5c85cfc813f9f8240bc9fd298b733f5225bd?hp=3b90fd9161349d784f8fd6d60e63a664a3f9411e>
- Log ----------------------------------------------------------------- commit 00bc5c85cfc813f9f8240bc9fd298b733f5225bd Author: Nicholas Clark <[email protected]> Date: Wed Sep 30 17:31:26 2015 +0200 Add a test for a goto regression from Aug 2010 fixed in Oct 2014. An obscure bug involving goto within the same scope in the presence of compile-time optimised away blocks was introduced in Aug 2010 by commit ac56e7de46621c6f, "Peephole optimise adjacent pairs of nextstate ops." The bug was fixed in Oct 2014 by commit f5b5c2a37af87535, "Simplify double-nextstate optimisation" Add a test, to ensure that we don't regress. ----------------------------------------------------------------------- Summary of changes: t/op/goto.t | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/t/op/goto.t b/t/op/goto.t index ca48ac0..d1e88d7 100644 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -10,7 +10,7 @@ BEGIN { use warnings; use strict; -plan tests => 94; +plan tests => 96; our $TODO; my $deprecated = 0; @@ -414,6 +414,38 @@ moretests: } } +# This bug was introduced in Aug 2010 by commit ac56e7de46621c6f +# Peephole optimise adjacent pairs of nextstate ops. +# and fixed in Oct 2014 by commit f5b5c2a37af87535 +# Simplify double-nextstate optimisation + +# The bug manifests as a warning +# Use of "goto" to jump into a construct is deprecated at t/op/goto.t line 442. +# and $out is undefined. Devel::Peek reveals that the lexical in the pad has +# been reset to undef. I infer that pp_goto thinks that it's leaving one scope +# and entering another, but I don't know *why* it thinks that. Whilst this bug +# has been fixed by Father C, because I don't understand why it happened, I am +# not confident that other related bugs remain (or have always existed). + +sub DEBUG_TIME() { + 0; +} + +{ + if (DEBUG_TIME) { + } + + { + my $out = ""; + $out .= 'perl rules'; + goto no_list; + no_list: + is($out, 'perl rules', '$out has not been erroneously reset to undef'); + }; +} + +is($deprecated, 0, 'no warning was emmitted'); + # deep recursion with gotos eventually caused a stack reallocation # which messed up buggy internals that didn't expect the stack to move -- Perl5 Master Repository
