This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don’t assume targs are contiguous for ‘my $x; my $y’
authorFather Chrysostomos <sprout@cpan.org>
Mon, 2 Sep 2013 15:29:50 +0000 (08:29 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 2 Sep 2013 15:30:15 +0000 (08:30 -0700)
In commit 18c931a3, the padrange optimisation was prevented from mak-
ing this assumption for ‘my ($x,$y)’, but the assumption was still
there in the code that combines multiple statements into one.

This would lead to assertion failures (or, as of ce0d59f, crashes
under non-debugging builds) if a keyword plugin declined to handle
the second ‘my’, but only after creating a padop.

This fixes a regression from 5.16 affecting Devel::CallParser under
threaded builds.

op.c

diff --git a/op.c b/op.c
index 23eeaaa..a41afd7 100644 (file)
--- a/op.c
+++ b/op.c
@@ -11153,8 +11153,8 @@ Perl_rpeep(pTHX_ OP *o)
                             && (   p->op_next->op_type == OP_NEXTSTATE
                                 || p->op_next->op_type == OP_DBSTATE)
                             && count < OPpPADRANGE_COUNTMASK
+                            && base + count == p->op_targ
                     ) {
-                        assert(base + count == p->op_targ);
                         count++;
                         followop = p->op_next;
                     }