In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e13dc8886fcabf88a521e8e73c358157b1fa4c8a?hp=d4a536238812d77cbbf90c75e785f7865401ab09>

- Log -----------------------------------------------------------------
commit e13dc8886fcabf88a521e8e73c358157b1fa4c8a
Author: Dagfinn Ilmari MannsÃ¥ker <[email protected]>
Date:   Thu Jun 22 20:41:58 2017 +0100

    [perl #131627] Fix multideref for $x{qw/a/->$*}
    
    qw// sets OPf_PARENS on the OP_CONST it generates, which persists when
    ->$* turns it into an OP_GV.
    
    This used to cause an assertion failure on debugging builds, and didn't
    get the multideref optimisation on non-debugging.
-----------------------------------------------------------------------

Summary of changes:
 op.c              |  4 ++--
 t/op/multideref.t | 12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/op.c b/op.c
index 23e1640d9a..83c1af858f 100644
--- a/op.c
+++ b/op.c
@@ -13085,9 +13085,9 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV 
orig_action, U8 hints)
                 case OP_GV:
                     /* it may be a package var index */
 
-                    ASSUME(!(o->op_flags & ~(OPf_WANT|OPf_SPECIAL)));
+                    ASSUME(!(o->op_flags & 
~(OPf_WANT|OPf_PARENS|OPf_SPECIAL)));
                     ASSUME(!(o->op_private & ~(OPpEARLY_CV)));
-                    if (  (o->op_flags &~ OPf_SPECIAL) != OPf_WANT_SCALAR
+                    if (  (o->op_flags & ~(OPf_PARENS|OPf_SPECIAL)) != 
OPf_WANT_SCALAR
                         || o->op_private != 0
                     )
                         break;
diff --git a/t/op/multideref.t b/t/op/multideref.t
index 199e523451..20ba1ca614 100644
--- a/t/op/multideref.t
+++ b/t/op/multideref.t
@@ -18,7 +18,7 @@ BEGIN {
 use warnings;
 use strict;
 
-plan 62;
+plan 63;
 
 
 # check that strict refs hint is handled
@@ -223,3 +223,13 @@ sub defer {}
     ok !defined $x[0][0],"RT #130727 part 2: array not autovivified";
 
 }
+
+# RT #131627: assertion failure on OPf_PAREN on OP_GV
+{
+    my @x = (10..12);
+    our $rt131627 = 1;
+
+    no strict qw(refs vars);
+    is $x[qw(rt131627)->$*], 11, 'RT #131627: $a[qw(var)->$*]';
+}
+

--
Perl5 Master Repository

Reply via email to