summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-19 05:27:31 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-19 05:27:31 +0000
commit71a29c3c6e68e84b4c2fa366c4878918712829a9 (patch)
tree6006140239eb94671f06f42e3ac3ef2095053f25 /op.c
parent3dcd9d33ba0f5c25b8e7a1285e47073c4ec85071 (diff)
downloadperl-71a29c3c6e68e84b4c2fa366c4878918712829a9.tar.gz
fix sort optimizer to not hang inside loops
p4raw-id: //depot/perl@5815
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/op.c b/op.c
index d162595ee2..97d2e4b7f6 100644
--- a/op.c
+++ b/op.c
@@ -5999,6 +5999,12 @@ Perl_ck_sort(pTHX_ OP *o)
for (k = kLISTOP->op_first->op_next; k; k = k->op_next) {
if (k->op_next == kid)
k->op_next = 0;
+ /* don't descend into loops */
+ else if (k->op_type == OP_ENTERLOOP
+ || k->op_type == OP_ENTERITER)
+ {
+ k = cLOOPx(k)->op_lastop;
+ }
}
}
else