summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Leadbeater <dgl@dgl.cx>2010-03-25 00:40:35 +0000
committerDavid Mitchell <davem@iabyn.com>2010-03-27 16:27:23 +0000
commitaaf643cef9412894b3ea120d62ac78b85d183930 (patch)
tree267e4f3f6675e5b777fc4267d5130c927cdb803a /op.c
parent7cf8de9f707ac211c67434c5349598951c28a81c (diff)
downloadperl-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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/op.c b/op.c
index c4289ce8d8..775492319e 100644
--- a/op.c
+++ b/op.c
@@ -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))