Skip to content

Commit cdec98f

Browse files
committed
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.
1 parent 932bca2 commit cdec98f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

op.c

+5
Original file line numberDiff line numberDiff line change
@@ -11884,6 +11884,11 @@ Perl_rpeep(pTHX_ OP *o)
1188411884
DEFER(cLOOP->op_lastop);
1188511885
break;
1188611886

11887+
case OP_ENTERTRY:
11888+
assert(cLOGOPo->op_other->op_type == OP_LEAVETRY);
11889+
DEFER(cLOGOPo->op_other);
11890+
break;
11891+
1188711892
case OP_SUBST:
1188811893
assert(!(cPMOP->op_pmflags & PMf_ONCE));
1188911894
while (cPMOP->op_pmstashstartu.op_pmreplstart &&

0 commit comments

Comments
 (0)