summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-11-16 18:23:34 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-11-16 18:23:34 -0800
commit82e85a9ce986972c02dda51b9fa63d84843ec468 (patch)
tree6df344d8c3c8659f9d7d11250dc79c36187bf691 /scope.c
parentc263379c498269adb3a24d6d48aec4e822fde5c7 (diff)
downloadperl-82e85a9ce986972c02dda51b9fa63d84843ec468.tar.gz
Fix assert fail with my $x; sub() {$x}
If $x is not referenced or used in lvalue context elsewhere, then the constant sub can actually share the same scalar as the enclosing sub’s pad. It doesn’t need to copy. And we don’t in that case, as of v5.21.5-421-g04472a8. But we need to make sure the PADTMP flag is turned off at scope exit if the pad has the only reference to the sub. (The PADTMP flag has been turned on as of v5.21.5-391-g5543332.)
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index 43e2e03119..8e13071a34 100644
--- a/scope.c
+++ b/scope.c
@@ -1076,6 +1076,7 @@ Perl_leave_scope(pTHX_ I32 base)
SvFLAGS(sv) &=~ (SVf_OK|SVf_IVisUV|SVf_UTF8);
break;
}
+ SvPADTMP_off(sv);
SvPADSTALE_on(sv); /* mark as no longer live */
}
else { /* Someone has a claim on this, so abandon it. */