This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_lvref() OP_[AH]SLICE => OP_LVREFSLICE flag issue
authorDavid Mitchell <davem@iabyn.com>
Mon, 27 Jun 2016 13:56:09 +0000 (14:56 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 27 Jun 2016 13:56:09 +0000 (14:56 +0100)
RT #128252 Assert fail in op.c

In S_lvref(), when it's converting an OP_ASLICE or OP_HSLICE into a
OP_LVREFSLICE op, it clears all private flags except those supported by
both ops.  Except that it got it wrong. OPpLVREF_ELEM isn't a valid flag
for OP_[AH]SLICE (that bit corresponds to OPpSLICEWARNING for [ah]slice)
and that bit isn't valid for OP_LVREFSLICE. So don't preserve that bit.

op.c

diff --git a/op.c b/op.c
index 8008a21..fccb5f6 100644 (file)
--- a/op.c
+++ b/op.c
@@ -2744,7 +2744,7 @@ S_lvref(pTHX_ OP *o, I32 type)
     case OP_ASLICE:
     case OP_HSLICE:
         OpTYPE_set(o, OP_LVREFSLICE);
-       o->op_private &= OPpLVAL_INTRO|OPpLVREF_ELEM;
+       o->op_private &= OPpLVAL_INTRO;
        return;
     case OP_NULL:
        if (o->op_flags & OPf_SPECIAL)          /* do BLOCK */