This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove invalid ASSUME from MULTIDEREF code
authorDavid Mitchell <davem@iabyn.com>
Tue, 10 Feb 2015 15:03:54 +0000 (15:03 +0000)
committerDavid Mitchell <davem@iabyn.com>
Tue, 10 Feb 2015 15:08:54 +0000 (15:08 +0000)
RT #123735

The code that examines ops looking for OP_MULTIDEREF candidates,
makes assertions about what flags it think can be present on ops;
the idea being that if those assumptions change, the optimisation
code may need changing too.

However, the following syntax-errored code

    print
    my(r)

can trigger the assertion about PARENS not being set on an OP_GV.
So don't assert that.

op.c

diff --git a/op.c b/op.c
index db53f97..dea09cf 100644 (file)
--- a/op.c
+++ b/op.c
@@ -12891,7 +12891,8 @@ Perl_rpeep(pTHX_ OP *o)
                  * update the code accordingly. This applies to all the
                  * other ASSUMEs in the block of code too.
                  */
-                ASSUME(!(o2->op_flags & ~(OPf_WANT|OPf_MOD|OPf_SPECIAL)));
+                ASSUME(!(o2->op_flags &
+                            ~(OPf_WANT|OPf_MOD|OPf_PARENS|OPf_SPECIAL)));
                 ASSUME(!(o2->op_private & ~OPpEARLY_CV));
 
                 o2 = o2->op_next;