From 6e585ca0b32392d502ae4276faab9761cc9b1188 Mon Sep 17 00:00:00 2001 From: Dave Mitchell Date: Tue, 22 Nov 2005 16:32:42 +0000 Subject: [perl #37725] perl segfaults on reversed array reference The 'for (reverse @a)' optimisation got its index wrong when create LVALUE SVs for undef elements p4raw-id: //depot/perl@26195 --- t/op/loopctl.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 't/op/loopctl.t') diff --git a/t/op/loopctl.t b/t/op/loopctl.t index 11fb7c8ef7..a8e23107cb 100644 --- a/t/op/loopctl.t +++ b/t/op/loopctl.t @@ -31,7 +31,7 @@ # # -- .robin. 2001-03-13 -print "1..46\n"; +print "1..47\n"; my $ok; @@ -992,3 +992,16 @@ print ($ok ? "ok 41\n" : "not ok 41\n"); } } + +{ + # [perl #37725] + + $a37725[3] = 1; # use package var + $i = 2; + for my $x (reverse @a37725) { + $x = $i++; + } + print "@a37725" == "5 4 3 2" ? "" : "not ", + "ok 47 - reverse with empty slots (@a37725)\n"; +} + -- cgit v1.2.1