In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/82269f56dcc21a3e0ef8c48158a731daf5ceda25?hp=a911bb254071ab7112c309e8245494c182ad9fe2>

- Log -----------------------------------------------------------------
commit 82269f56dcc21a3e0ef8c48158a731daf5ceda25
Author: David Mitchell <[email protected]>
Date:   Wed Apr 22 16:26:40 2015 +0100

    RT #124207: assert failure in ck_stringify()
    
    v5.21.4-416-g73f4c4f converted (among other things) stringify(join(...))
    into just join(...).  It asserted that the stringify didn't have any extra
    children, which it won't normally do, since in something like "@a-" the
    elements of the stringify get bundled up into a single tree of concats
    etc, and stringify just sees a single top-level join or concat or
    whatever. However during error recovery weird stuff can get left on the
    stack.
    
    So rather than asserting no more kids, skip the optimisation if there are
    more kids.
-----------------------------------------------------------------------

Summary of changes:
 op.c            |  8 ++++----
 t/comp/parser.t | 11 +++++++++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/op.c b/op.c
index 4e8f5a4..afaae61 100644
--- a/op.c
+++ b/op.c
@@ -11118,11 +11118,11 @@ Perl_ck_stringify(pTHX_ OP *o)
 {
     OP * const kid = OpSIBLING(cUNOPo->op_first);
     PERL_ARGS_ASSERT_CK_STRINGIFY;
-    if (kid->op_type == OP_JOIN || kid->op_type == OP_QUOTEMETA
-     || kid->op_type == OP_LC   || kid->op_type == OP_LCFIRST
-     || kid->op_type == OP_UC   || kid->op_type == OP_UCFIRST)
+    if ((   kid->op_type == OP_JOIN || kid->op_type == OP_QUOTEMETA
+         || kid->op_type == OP_LC   || kid->op_type == OP_LCFIRST
+         || kid->op_type == OP_UC   || kid->op_type == OP_UCFIRST)
+       && !OpHAS_SIBLING(kid)) /* syntax errs can leave extra children */
     {
-       assert(!OpHAS_SIBLING(kid));
        op_sibling_splice(o, cUNOPo->op_first, -1, NULL);
        op_free(o);
        return kid;
diff --git a/t/comp/parser.t b/t/comp/parser.t
index a4ae052..50f601c 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -8,7 +8,7 @@ BEGIN {
     chdir 't' if -d 't';
 }
 
-print "1..172\n";
+print "1..173\n";
 
 sub failed {
     my ($got, $expected, $name) = @_;
@@ -540,6 +540,13 @@ eval "grep+grep";
  eval 'my $_; m// ~~ 0';
 }
 
+# RT #124207 syntax error during stringify can leave stringify op
+# with multiple children and assertion failures
+
+eval 'qq{@{0]}${}},{})';
+is(1, 1, "RT #124207");
+
+
 # Add new tests HERE (above this line)
 
 # bug #74022: Loop on characters in \p{OtherIDContinue}
@@ -688,4 +695,4 @@ check_line(642, 'line number after ${expr} surrounding 
heredoc body');
 
 
 __END__
-# Don't add new tests HERE. See note above
+# Don't add new tests HERE. See "Add new tests HERE" above.

--
Perl5 Master Repository

Reply via email to