summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-03-06 13:32:56 +0000
committerDavid Mitchell <davem@iabyn.com>2014-03-16 18:34:37 +0000
commitcdec98ff86310d40c5a05f14e7e624f52ddcc156 (patch)
treef678e339c5e4aa96c02a321cadc525cadcb135a6 /op.c
parent932bca295d64243e2ef2aeaacc779b68cc05e1b2 (diff)
downloadperl-cdec98ff86310d40c5a05f14e7e624f52ddcc156.tar.gz
code following eval {} not always optimised
In something like this eval { 1 while 1 }; $x = $a[0]; The optimising of the while loop makes Perl_rpeep() miss processing the chain of ops from the OP_LEAVETRY onwards. So in the code above for example, the alem wont be optimised into an alemfast. Fix this by explicitly recursing into the entertry->op_other branch (which actually points at the leavetry). The infinite loop above can be broken by, for example, a signal handler calling die.
Diffstat (limited to 'op.c')
-rw-r--r--op.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/op.c b/op.c
index 4f3c570f7b..8c332a9cb2 100644
--- a/op.c
+++ b/op.c
@@ -11884,6 +11884,11 @@ Perl_rpeep(pTHX_ OP *o)
DEFER(cLOOP->op_lastop);
break;
+ case OP_ENTERTRY:
+ assert(cLOGOPo->op_other->op_type == OP_LEAVETRY);
+ DEFER(cLOGOPo->op_other);
+ break;
+
case OP_SUBST:
assert(!(cPMOP->op_pmflags & PMf_ONCE));
while (cPMOP->op_pmstashstartu.op_pmreplstart &&