summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-10-16 17:44:56 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-10-16 17:44:56 -0700
commit0d42e778cfa0ef9c7315b82e62a6c9fe0cb1cec5 (patch)
treeb17dda209f17b6c3fd932857c677b06649ed281c /t/op
parent0298c7603f0a7ee6e46fc9ebc8283c40ee2f6ad4 (diff)
downloadperl-0d42e778cfa0ef9c7315b82e62a6c9fe0cb1cec5.tar.gz
[perl #122995] Hang with while(1) in a sub-list
It was hanging at compile time in some cases, e.g.: sub foo { () = ($a, my $b, ($c, do { while(1) {} })) } The optimisation added in 5.20 to turn list+pushmark into null ops when they are in list context (effectively making ($a,($b,$c)) equiva- lent to ($a,$b,$c) with regard to which ops are executed) followed op_next pointers to find the last op that was a kid of the sublist. You can’t just follow op_next pointers like that, because it will loop at compile time on infinite loops like while (1){}. In this case, the last kid was being found in order to elide the erst- while list op from the op_next chain, but that is not necessary, since later OP_NULL handling takes care of it anyway.
Diffstat (limited to 't/op')
-rw-r--r--t/op/list.t4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/op/list.t b/t/op/list.t
index d14873f3a2..3f42e6d8e2 100644
--- a/t/op/list.t
+++ b/t/op/list.t
@@ -190,3 +190,7 @@ sub {
)
}
->(("${\''}")[0,0]);
+
+# [perl #122995] Hang when compiling while(1) in a sub-list
+# No ok() or is() necessary.
+sub foo { () = ($a, my $b, ($c, do { while(1) {} })) }