This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix core dump bug with anoncode
authorChip Salzenberg <chip@atlantic.net>
Thu, 19 Dec 1996 04:11:05 +0000 (16:11 +1200)
committerChip Salzenberg <chip@atlantic.net>
Thu, 19 Dec 1996 23:14:00 +0000 (11:14 +1200)
op.c

diff --git a/op.c b/op.c
index a7460b1..56624e3 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3384,8 +3384,16 @@ OP *
 ck_anoncode(op)
 OP *op;
 {
-    PADOFFSET ix = pad_alloc(op->op_type, SVs_PADMY);
-    av_store(comppad_name, ix, newSVpv("&", 1));
+    PADOFFSET ix;
+    SV* name;
+
+    name = NEWSV(1106,0);
+    sv_upgrade(name, SVt_PVNV);
+    sv_setpvn(name, "&", 1);
+    SvIVX(name) = -1;
+    SvNVX(name) = 1;
+    ix = pad_alloc(op->op_type, SVs_PADMY);
+    av_store(comppad_name, ix, name);
     av_store(comppad, ix, cSVOP->op_sv);
     SvPADMY_on(cSVOP->op_sv);
     cSVOP->op_sv = Nullsv;