This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Permit array assignment to steal temps and copy shared hash key scalars.
authorNicholas Clark <nick@ccl4.org>
Sun, 2 May 2010 20:04:32 +0000 (21:04 +0100)
committerNicholas Clark <nick@ccl4.org>
Sun, 2 May 2010 20:04:32 +0000 (21:04 +0100)
Scalar assignment to array elements already does this. (As does all other
scalar assignment, and list assignment to hashes.) Prior to 4c8f17b905f2
(change 7867) list assignment to arrays did steal temps.

pp_hot.c

index 95a6822..ea949b8 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1037,7 +1037,8 @@ PP(pp_aassign)
            while (relem <= lastrelem) {        /* gobble up all the rest */
                SV **didstore;
                assert(*relem);
-               sv = newSVsv(*relem);
+               sv = newSV(0);
+               sv_setsv(sv, *relem);
                *(relem++) = sv;
                didstore = av_store(ary,i++,sv);
                if (magic) {