diff options
author | David Leadbeater <dgl@dgl.cx> | 2010-03-25 00:40:35 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-03-27 16:27:23 +0000 |
commit | aaf643cef9412894b3ea120d62ac78b85d183930 (patch) | |
tree | 267e4f3f6675e5b777fc4267d5130c927cdb803a /op.c | |
parent | 7cf8de9f707ac211c67434c5349598951c28a81c (diff) | |
download | perl-aaf643cef9412894b3ea120d62ac78b85d183930.tar.gz |
[perl #73720] opt_scalarhv(or OP_BOOLKEYS) does not work
An optimisation for %hash in boolean context, as introduced with
867fa1e2da145229b4db2c6e8d5b51700c15f114
could falsely optimise constructs that shoudn't be.
Original bug report and fix suggestion were by Goro Fuji.
Include a test to cover the case which was mis-optimised (although
coverage still seems low to me).
Additionally correct B::Deparse (just swap a line, it was using a
variable before it was defined).
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -8680,7 +8680,7 @@ Perl_peep(pTHX_ register OP *o) ){ OP * nop = o; OP * lop = o; - if (!(nop->op_flags && OPf_WANT_VOID)) { + if (!((nop->op_flags & OPf_WANT) == OPf_WANT_VOID)) { while (nop && nop->op_next) { switch (nop->op_next->op_type) { case OP_NOT: @@ -8698,7 +8698,7 @@ Perl_peep(pTHX_ register OP *o) } } } - if (lop->op_flags && OPf_WANT_VOID) { + if ((lop->op_flags & OPf_WANT) == OPf_WANT_VOID) { if (fop->op_type == OP_PADHV || fop->op_type == OP_RV2HV) cLOGOP->op_first = opt_scalarhv(fop); if (sop && (sop->op_type == OP_PADHV || sop->op_type == OP_RV2HV)) |