av_fetch(): remove check for freed SV
Currently av_fetch() has this extra test:
if (AvREIFY(av) && SvIS_FREED(AvARRAY(av)[key])) {
/* eg. @_ could have freed elts */
AvARRAY(av)[key] = NULL; /* 1/2 reify */
which basically says that if the array has the reify flag set (typically
only @_ has this) and if the element being retrieved in it has been freed,
then replace it with an undef value instead.
This can be triggered with code like:
sub f {
$r = 0;
my $var = $_[0];
}
$r = do { my $x; \$x };
f($$r);
which leaves $var as undef rather than causing a "panic: attempt to copy
freed scalar".
However, code like
my ($var) = @_;
*won't* get handled specially, and will still trigger the panic.
It was added in 1996 as a result of this thread:
From: Andreas Koenig <k@anna.in-berlin.de>
Subject: SEGV with $_[0] and circular references
Message-Id: <
199608131528.RAA25965@anna.in-berlin.de>
That was in the context of getting a SEGV - whereas now we get the
"panic: attempt to copy freed scalar" instead.
It was agreed in this thread that it could be removed:
http://nntp.perl.org/group/perl.perl5.porters/239082