[Bug d/101640] d: Wrong evaluation order of binary expressions
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 28 11:37:00 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101640
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:d3c268943c339e994802656ce71ef654cc2a349f
commit r11-8810-gd3c268943c339e994802656ce71ef654cc2a349f
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Tue Jul 27 13:24:34 2021 +0200
d: Wrong evaluation order of binary expressions (PR101640)
The use of fold_build2 can in some cases swap the order of its operands
if that is the more optimal thing to do. However this breaks semantic
guarantee of left-to-right evaluation in D.
PR d/101640
gcc/d/ChangeLog:
* expr.cc (binary_op): Use build2 instead of fold_build2.
gcc/testsuite/ChangeLog:
* gdc.dg/pr96429.d: Update test.
* gdc.dg/pr101640.d: New test.
(cherry picked from commit 54ec50bada94a8ff92edb04ee5216c27fa4bf942)
More information about the Gcc-bugs
mailing list