This is a live mirror of the Perl 5 development currently hosted at
op.c:ck_rvconst: Allocate GV pad slots like constants
authorFather Chrysostomos <>
Wed, 27 Aug 2014 01:06:48 +0000 (18:06 -0700)
committerFather Chrysostomos <>
Thu, 28 Aug 2014 20:04:16 +0000 (13:04 -0700)
Requesting a pad slot for a constant (and GVs in pads are like con-
stants, in that the pad slot will always hold that same value, which
is shared in recursion) will instruct pad_alloc to avoid anything
marked PADTMP; i.e., a  slot used as a target by a previous statement.

Without this, we get an assertion failure from ‘miniperl -MExporter’
under -Accflags=-DUSE_BROKEN_PAD_RESET and threads.

With this commit, we get ‘Modification of a read-only value attempted’
instead, which is some progress. :-)


diff --git a/op.c b/op.c
index e017842..357a524 100644 (file)
--- a/op.c
+++ b/op.c
@@ -8886,7 +8886,7 @@ Perl_ck_rvconst(pTHX_ OP *o)
            /* XXX hack: dependence on sizeof(PADOP) <= sizeof(SVOP) */
            assert (sizeof(PADOP) <= sizeof(SVOP));
-           kPADOP->op_padix = pad_alloc(OP_GV, SVs_PADTMP);
+           kPADOP->op_padix = pad_alloc(OP_GV, SVf_READONLY);
            PAD_SETSV(kPADOP->op_padix, MUTABLE_SV(SvREFCNT_inc_simple_NN(gv)));