This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
avoid sort assert failure after compile fail
authorDavid Mitchell <davem@iabyn.com>
Mon, 23 Jan 2017 12:27:20 +0000 (12:27 +0000)
committerDavid Mitchell <davem@iabyn.com>
Mon, 23 Jan 2017 12:27:20 +0000 (12:27 +0000)
RT #130617

in rpeep(), there's an assert that the optree is sane for the sort's
codeblock. After compile errors, it isn;t necessary sane, so skip the
assert in that case.

I've also changed a kLISTOP->op_next into the equivalent but less
obfuscated kid->op_next.

op.c

diff --git a/op.c b/op.c
index d2fd198..0ba58c7 100644 (file)
--- a/op.c
+++ b/op.c
@@ -14446,8 +14446,9 @@ Perl_rpeep(pTHX_ OP *o)
                       && (  kid->op_targ == OP_NEXTSTATE
                          || kid->op_targ == OP_DBSTATE  ))
                     || kid->op_type == OP_STUB
-                    || kid->op_type == OP_ENTER);
-                nullop->op_next = kLISTOP->op_next;
+                    || kid->op_type == OP_ENTER
+                    || (PL_parser && PL_parser->error_count));
+                nullop->op_next = kid->op_next;
                 DEFER(nullop->op_next);
            }