diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-09 12:50:54 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-09 12:50:54 -0800 |
commit | 3baa0581042942aae9615e055ff2f1ac123840db (patch) | |
tree | f4a91711ce738963fd55fad57ccce5a5556577b2 /lib | |
parent | 1a5644fdf09df9d44c36dcd1dfee4adbe1d64af7 (diff) | |
download | perl-3baa0581042942aae9615e055ff2f1ac123840db.tar.gz |
Don’t allow OPpTARGET_MY on postdec/inc
I was wrong in 9e319cc4f. postfix ++/-- writes to its return value
before reading its argument. If we optimise away the scalar
assignment in
$a = $b++;
(that’s what OPpTARGET_MY does), then $a gets written to before $b is
read. If $a and $b are the same, we get the wrong answer. This bug
has been present under ‘use integer’ since 5.6.0. I accidentally
extended it to non-integer ++/-- in 9e319cc4f.
(It’s not likely that someone will write $a = $b++, but it could hap-
pen inadvertently in more complex code.)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/B/Op_private.pm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index 730964c261..cdc91dc510 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -142,7 +142,7 @@ $bits{$_}{7} = 'OPpPV_IS_UTF8' for qw(dump goto last next redo); $bits{$_}{6} = 'OPpREFCOUNTED' for qw(leave leaveeval leavesub leavesublv leavewrite); $bits{$_}{6} = 'OPpRUNTIME' for qw(match pushre qr subst substcont); $bits{$_}{2} = 'OPpSLICEWARNING' for qw(aslice hslice padav padhv rv2av rv2hv); -$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_negate i_postdec i_postinc i_subtract index int kill left_shift length link log match mkdir modulo multiply oct ord postdec postinc pow push rand rename repeat right_shift rindex rmdir schomp setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid); +$bits{$_}{4} = 'OPpTARGET_MY' for qw(abs add atan2 chdir chmod chomp chown chr chroot concat cos crypt divide exec exp flock getpgrp getppid getpriority hex i_add i_divide i_modulo i_multiply i_negate i_subtract index int kill left_shift length link log match mkdir modulo multiply oct ord pow push rand rename repeat right_shift rindex rmdir schomp setpgrp setpriority sin sleep split sqrt srand stringify subst subtract symlink system time trans transr unlink unshift utime vec wait waitpid); $bits{$_}{5} = 'OPpTRANS_COMPLEMENT' for qw(trans transr); $bits{$_}{7} = 'OPpTRANS_DELETE' for qw(trans transr); $bits{$_}{0} = 'OPpTRANS_FROM_UTF' for qw(trans transr); |