File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -5999,6 +5999,12 @@ Perl_ck_sort(pTHX_ OP *o)
5999
5999
for (k = kLISTOP -> op_first -> op_next ; k ; k = k -> op_next ) {
6000
6000
if (k -> op_next == kid )
6001
6001
k -> op_next = 0 ;
6002
+ /* don't descend into loops */
6003
+ else if (k -> op_type == OP_ENTERLOOP
6004
+ || k -> op_type == OP_ENTERITER )
6005
+ {
6006
+ k = cLOOPx (k )-> op_lastop ;
6007
+ }
6002
6008
}
6003
6009
}
6004
6010
else
Original file line number Diff line number Diff line change @@ -13,6 +13,15 @@ print "1..49\n";
13
13
$ENV {PERL_DESTRUCT_LEVEL } = 0 unless $ENV {PERL_DESTRUCT_LEVEL } > 3;
14
14
}
15
15
16
+ # these shouldn't hang
17
+ {
18
+ no warnings;
19
+ sort { for ($_ = 0;; $_ ++) {} } @a ;
20
+ sort { while (1) {} } @a ;
21
+ sort { while (1) { last ; } } @a ;
22
+ sort { while (0) { last ; } } @a ;
23
+ }
24
+
16
25
sub Backwards { $a lt $b ? 1 : $a gt $b ? -1 : 0 }
17
26
sub Backwards_stacked ($$) { my ($a ,$b ) = @_ ; $a lt $b ? 1 : $a gt $b ? -1 : 0 }
18
27
You can’t perform that action at this time.
0 commit comments