This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pad.c:pad_free: Don’t reset PL_padix if using pad_reset
authorFather Chrysostomos <sprout@cpan.org>
Wed, 27 Aug 2014 15:27:03 +0000 (08:27 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 28 Aug 2014 20:04:17 +0000 (13:04 -0700)
pad_reset causes PL_padix to be reset at the beginning of each state-
ment, so that operator targets can be reused.

If we also reset it when freeing an operator, then theoretically tar-
gets from operators later on in the same statement might be reused.  I
can’t come up with a test case, but it’s better to be safe than sorry.

pad.c

diff --git a/pad.c b/pad.c
index 271a9d8..be3d055 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1843,10 +1843,10 @@ Perl_pad_free(pTHX_ PADOFFSET po)
     sv = PL_curpad[po];
     if (sv && sv != &PL_sv_undef && !SvPADMY(sv))
        SvFLAGS(sv) &= ~SVs_PADTMP;
-#endif
 
     if ((I32)po < PL_padix)
        PL_padix = po - 1;
+#endif
 }
 
 /*