In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/09681a13f07600082e5a7efbc9c978f62b24c502?hp=702e1efd849c4e184950c524f107ecd2e7d19a77>

- Log -----------------------------------------------------------------
commit 09681a13f07600082e5a7efbc9c978f62b24c502
Author: David Mitchell <da...@iabyn.com>
Date:   Thu Nov 19 15:49:03 2015 +0000

    op_free(): don't assert op_private ok when erred
    
    [perl #126258]
    
    op_free includes an assert to make sure each op's op_private field
    only has the flags set that are expected for that op. It's a thing I added
    at the same time I added the regen/op_private mechanism, and is more a
    general "make sure people are only setting the flags we know about" test.
    
    However, if the op tree is being freed after a compilation error, some
    op's flags may be in an inconsistent state; so skip the assert in that case.
    
    e.g.
    
        perl -e 'grep$0,0}'
-----------------------------------------------------------------------

Summary of changes:
 op.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/op.c b/op.c
index 0c2af88..a9cfe72 100644
--- a/op.c
+++ b/op.c
@@ -712,10 +712,23 @@ Perl_op_free(pTHX_ OP *o)
         type = o->op_type;
 
         /* an op should only ever acquire op_private flags that we know about.
-         * If this fails, you may need to fix something in regen/op_private */
-        if (o->op_ppaddr == PL_ppaddr[o->op_type]) {
+         * If this fails, you may need to fix something in regen/op_private.
+         * Don't bother testing if:
+         *   * the op_ppaddr doesn't match the op; someone may have
+         *     overridden the op and be doing strange things with it;
+         *   * we've errored, as op flags are often left in an
+         *     inconsistent state then. Note that an error when
+         *     compiling the main program leaves PL_parser NULL, so
+         *     we can't spot faults in the main code, onoly
+         *     evaled/required code */
+#ifdef DEBUGGING
+        if (   o->op_ppaddr == PL_ppaddr[o->op_type]
+            && PL_parser
+            && !PL_parser->error_count)
+        {
             assert(!(o->op_private & ~PL_op_private_valid[type]));
         }
+#endif
 
         if (o->op_private & OPpREFCOUNTED) {
             switch (type) {

--
Perl5 Master Repository

Reply via email to