diff options
author | Father Chrysostomos <sprout@cpan.org> | 2009-12-14 16:15:51 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2009-12-14 16:15:51 +0100 |
commit | 0f907b96d618c97cd2e020841a70ae037954a616 (patch) | |
tree | ea5dd38a108bbcb88d35ea1344797edc4cfa00ff /t | |
parent | 2ab54efd6265713df5cd4bd0927024245675c1c2 (diff) | |
download | perl-0f907b96d618c97cd2e020841a70ae037954a616.tar.gz |
[perl #70171] 5.10.0 -> 5.10.1 Regression in fafafbaf70 (Big slowdown in 5.10 @_ parameter passing)
In this case my %x = %$x assigns a hash to itself. This causes the
hv_clear in pp_aassign to wipe away the hash before it can be copied.
The ‘panic: attempt to copy freed scalar’ error is triggered by this
line, which copies the value:
sv_setsv(tmpstr,*relem); /* value */
The solution is to make sure the OPpASSIGN_COMMON flag is on in such
cases, so that pp_aassign copies everything before doing the assignment.
Diffstat (limited to 't')
-rw-r--r-- | t/op/array.t | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/t/op/array.t b/t/op/array.t index 0027f4babf..e36fd287ed 100644 --- a/t/op/array.t +++ b/t/op/array.t @@ -7,7 +7,7 @@ BEGIN { require 'test.pl'; -plan (125); +plan (127); # # @foo, @bar, and @ary are also used from tie-stdarray after tie-ing them @@ -428,5 +428,19 @@ sub test_arylen { is("$x $y $z", "1 1 2"); } +# [perl #70171] +{ + my $x = get_x(); my %x = %$x; sub get_x { %x=(1..4); return \%x }; + is( + join(" ", map +($_,$x{$_}), sort keys %x), "1 2 3 4", + 'bug 70171 (self-assignment via my %x = %$x)' + ); + my $y = get_y(); my @y = @$y; sub get_y { @y=(1..4); return \@y }; + is( + "@y", "1 2 3 4", + 'bug 70171 (self-assignment via my @x = @$x)' + ); +} + "We're included by lib/Tie/Array/std.t so we need to return something true"; |