Stop creating defelems for undef in foreach(@_)
This is part of ticket #119433. This particular bug is triggered by
Data::Dump’s test suite.
Commit ce0d59f changed arrays to use NULL for nonexistent elements,
instead of &PL_sv_undef (the special scalar returned by Perl’s ‘undef’
operator).
‘foreach’ was not updated to account. It was still treating
&PL_sv_undef as a nonexistent element. This was causing ‘Modifica-
tion of non-creatable array value attempted, subscript 0’, due to a
similar bug in vivify_defelem, which the next commit will fix.
(Fixing vivify_defelem without fixing foreach will make the test pass,
but for foreach to create a defelem to begin with is inefficient and
should be addressed anyway.)