diff options
-rw-r--r-- | op.c | 2 | ||||
-rwxr-xr-x | t/op/grep.t | 7 |
2 files changed, 7 insertions, 2 deletions
@@ -5430,7 +5430,7 @@ Perl_ck_grep(pTHX_ OP *o) OP* k; o = ck_sort(o); kid = cLISTOPo->op_first->op_sibling; - for (k = cLISTOPo->op_first->op_sibling->op_next; k; k = k->op_next) { + for (k = cUNOPx(kid)->op_first; k; k = k->op_next) { kid = k; } kid->op_next = (OP*)gwop; diff --git a/t/op/grep.t b/t/op/grep.t index 4696224c44..3e5d7168a0 100755 --- a/t/op/grep.t +++ b/t/op/grep.t @@ -4,7 +4,7 @@ # grep() and map() tests # -print "1..37\n"; +print "1..38\n"; $test = 1; @@ -162,3 +162,8 @@ sub ok { undef $gimme; map { gimme } @list; ok($gimme, 'list'); $test++; } +{ + # This shouldn't loop indefinitively. + my @empty = map { while (1) {} } (); + ok("@empty", ''); +} |