summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2004-04-01 06:01:25 +0000
committerMarcus Holland-Moritz <mhx-perl@gmx.net>2004-04-01 06:01:25 +0000
commit75cc09e40ef43ffdb7866f862ed8a8f1528a2d9e (patch)
tree0ca95e03b5afc631e10a37489e8c74ffde2a8577 /op.c
parenta62140726edcf5b33bdd8fed9a26ab90d77ec144 (diff)
downloadperl-75cc09e40ef43ffdb7866f862ed8a8f1528a2d9e.tar.gz
Fix and tests for [perl #28123] Perl optimizes // away incorrectly
p4raw-id: //depot/perl@22625
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/op.c b/op.c
index a13a7ef1b9..25db0927b6 100644
--- a/op.c
+++ b/op.c
@@ -3368,7 +3368,9 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
no_bareword_allowed(first);
else if (ckWARN(WARN_BAREWORD) && (first->op_private & OPpCONST_BARE))
Perl_warner(aTHX_ packWARN(WARN_BAREWORD), "Bareword found in conditional");
- if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) {
+ if ((type == OP_AND && SvTRUE(((SVOP*)first)->op_sv)) ||
+ (type == OP_OR && !SvTRUE(((SVOP*)first)->op_sv)) ||
+ (type == OP_DOR && !SvOK(((SVOP*)first)->op_sv))) {
op_free(first);
*firstp = Nullop;
other->op_private |= OPpCONST_SHORTCIRCUIT;