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 /regen | |
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 'regen')
-rw-r--r-- | regen/opcodes | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/regen/opcodes b/regen/opcodes index 0176e55b1a..2a0430dc0e 100644 --- a/regen/opcodes +++ b/regen/opcodes @@ -111,10 +111,10 @@ preinc preincrement (++) ck_lfun dIs1 S i_preinc integer preincrement (++) ck_lfun dis1 S predec predecrement (--) ck_lfun dIs1 S i_predec integer predecrement (--) ck_lfun dis1 S -postinc postincrement (++) ck_lfun IsT1 S -i_postinc integer postincrement (++) ck_lfun isT1 S -postdec postdecrement (--) ck_lfun IsT1 S -i_postdec integer postdecrement (--) ck_lfun isT1 S +postinc postincrement (++) ck_lfun Ist1 S +i_postinc integer postincrement (++) ck_lfun ist1 S +postdec postdecrement (--) ck_lfun Ist1 S +i_postdec integer postdecrement (--) ck_lfun ist1 S # Ordinary operators. |