This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Hash assignment can zap weak references to the hash
[perl5.git] / pp_hot.c
index bd0f909..d66ddde 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2611,7 +2611,10 @@ PP(pp_leavesublv)
            if (MARK == SP) {
                /* Temporaries are bad unless they happen to be elements
                 * of a tied hash or array */
-               if (SvFLAGS(TOPs) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY) &&
+               if ((SvFLAGS(TOPs) & (SVs_TEMP | SVs_PADTMP) ||
+                    (SvFLAGS(TOPs) & (SVf_READONLY | SVf_FAKE))
+                      == SVf_READONLY
+                   ) &&
                    !(SvRMAGICAL(TOPs) && mg_find(TOPs, PERL_MAGIC_tiedelem))) {
                    LEAVE;
                    cxstack_ix--;