This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sv_inc/dec_nomg(): croak on GVs etc
RT #126637
Prior to v5.23.4-100-g20e9643, pp_postinc() etc checked whether the SV was
an AV, non-fake GV, or any other such non-modifiable thinngy; and if so,
called Perl_croak_no_modify(). That commit of mine removed the check, and
instead relied on the underlying sv_inc_nomg() function (called by
pp_postinc()) to do the checking instead. It turns out that while
sv_inc_nomg() etc does some checks, it wasn't as thorough as pp_postinc().
So something like
my $y = $_++ for *FOO;
now crashes with an assertion failure in sv_inc_nomg() rather than
croaking.
This commit adds such checks to sv_inc_nomg() and sv_dec_nomg() - which
need them anyway, since they may be called from places other than
pp_postinc() etc.