int
Perl_magic_set_all_env(pTHX_ SV *sv, MAGIC *mg)
{
+ PERL_UNUSED_ARG(mg);
#if defined(VMS)
Perl_die(aTHX_ "Can't make list assignment to %%ENV on this system");
#else
SV **svp = AvARRAY(av);
PERL_UNUSED_ARG(sv);
- if (svp) {
+ /* Not sure why the av can get freed ahead of its sv, but somehow it does
+ in ext/B/t/bytecode.t test 15 (involving print <DATA>) */
+ if (svp && !SvIS_FREED(av)) {
SV *const *const last = svp + AvFILLp(av);
while (svp <= last) {