This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix read-only flag checks in lvalue sub exit
authorFather Chrysostomos <sprout@cpan.org>
Sat, 20 Sep 2014 13:55:39 +0000 (06:55 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 20 Sep 2014 16:25:02 +0000 (09:25 -0700)
commit3885a45a68b1e213942bbd5c25da091b4785423e
treefcdef2ceb3f3a7a726ead52a67cb01f2362165b5
parent57c404c9ca0d045fece7cbd7010d0d084cef5821
Fix read-only flag checks in lvalue sub exit

See the previous commit for the explanation.  This fixes this
discrepancy:

$ ./miniperl -Ilib -e '+sub:lvalue{my $x = 3; Internals::SvREADONLY $x, 1; $x }->() = 3'
Can't return a readonly value from lvalue subroutine at -e line 1.
$ ./miniperl -Ilib -e '+sub:lvalue{my $x = *foo; Internals::SvREADONLY $x, 1; $x }->() = 3'
Modification of a read-only value attempted at -e line 1.

It was not just a flag check that this commit fixed, but also a bogus
SvREADONLY(TOPs) where TOPs may not even be the scalar we are dying
for, giving ‘a temporary’ for some read-only values.  That mistake was
my own, made in commit d25b0d7b8.
pp_ctl.c
t/op/sub_lval.t