I am currently rewriting Perl_gv_add_by_type but I see something strange in the existing code. http://perl5.git.perl.org/perl.git/commitdiff/13be902cef8b01c085a6b8b1b59fa2754a10cdfb https://rt.perl.org/Ticket/Display.html?id=77362 So what is the sv_u of a PVLV? Why would a LV have a GP ptr? I thought the sv_u of a PVLV was a PV buffer. I have some old XS code to de-magic/vivify a hash slice, since otherwise I need to croak. if (SvREADONLY(buffer)) { croak(PL_no_modify); } if(SvTYPE(buffer) == SVt_PVLV && LvTYPE(buffer) == 'y'){ sv_setpv_mg(buffer, " "); if(LvTARG(buffer)) buffer = LvTARG(buffer); } if (SvMAGICAL(buffer)) { DumpSV(buffer); croak("%s: magic scalar as buffer not supported.", cvname); }