This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c: op_clear is tempting fate
authorFather Chrysostomos <sprout@cpan.org>
Thu, 26 Jul 2012 05:19:56 +0000 (22:19 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 26 Jul 2012 05:20:23 +0000 (22:20 -0700)
This if() statement can be reached by op types to which the OpTRANS*
flags to not apply.  They happen at present not to use any flags that
conflict with these (except when OPf_KIDS is set, in which case this
code is not reached).   But we should make sure, via an assertion,
that new flags added to goto or last do not conflict with trans utf8
flags, and that trans utf8 flags (1 and 2), if renumbered, do not con-
flict with goto/last utf8 flags (128).

op.c

diff --git a/op.c b/op.c
index b433227..c613290 100644 (file)
--- a/op.c
+++ b/op.c
@@ -819,6 +819,7 @@ Perl_op_clear(pTHX_ OP *o)
     case OP_TRANS:
     case OP_TRANSR:
        if (o->op_private & (OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF)) {
+           assert(o->op_type == OP_TRANS || o->op_type == OP_TRANSR);
 #ifdef USE_ITHREADS
            if (cPADOPo->op_padix > 0) {
                pad_swipe(cPADOPo->op_padix, TRUE);