This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
stop the eliding of void $pkg_var from assert fail
authorDavid Mitchell <davem@iabyn.com>
Wed, 9 Dec 2015 12:34:45 +0000 (12:34 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 9 Dec 2015 13:03:13 +0000 (13:03 +0000)
The code to eliminate things like our($foo); from the runtime op_next
chain in rpeep() caused the oldoldop, oldop, o vars not to form a chain of
3 adjacent ops. Instead, oldoldop and oldop ended up equal, which later
caused an assertion failure in the padrange code for something like

    my($a,$b),$x,my($c,$d);

op.c
t/op/my.t

diff --git a/op.c b/op.c
index d8dfbd3..bc6263b 100644 (file)
--- a/op.c
+++ b/op.c
@@ -13855,7 +13855,8 @@ Perl_rpeep(pTHX_ OP *o)
                    oldoldop = NULL;
                    goto redo;
                }
-               o = oldop;
+               o = oldop->op_next;
+                goto redo;
            }
            else if (o->op_next->op_type == OP_RV2SV) {
                if (!(o->op_next->op_private & OPpDEREF)) {
index 2dca46f..e76fc5e 100644 (file)
--- a/t/op/my.t
+++ b/t/op/my.t
@@ -149,5 +149,10 @@ is( $@, '', 'no errors while checking autovivification and persistence of hash r
 eval "my ()";
 is( $@, '', "eval of my() passes");
 
+# RT #126844
+# This triggered a compile-time assert failure in rpeep()
+eval 'my($a,$b),$x,my($c,$d)';
+pass("RT #126844");
+
 #Variable number of tests due to the way the while/for loops are tested now
 done_testing();