fold-const: do not fold NaN result from non-NaN operands [PR95115]
authorXi Ruoyao <xry111@mengyan1223.wang>
Sun, 30 Jan 2022 17:15:20 +0000 (01:15 +0800)
committerXi Ruoyao <xry111@mengyan1223.wang>
Tue, 1 Feb 2022 10:20:57 +0000 (18:20 +0800)
commit34afa19d29c5bf0b0f504e4d0aca4e9a8bc82c5c
tree974df02b77f39a5ad90e502b19d94fcef6d406f6
parentd43fbc7d3f7621e1c8f153c1471d2a5cd20bfdc8
fold-const: do not fold NaN result from non-NaN operands [PR95115]

These operations should raise an invalid operation exception at runtime.
So they should not be folded during compilation unless -fno-trapping-math
is used.

gcc/
PR middle-end/95115
* fold-const.cc (const_binop): Do not fold NaN result from
  non-NaN operands.

gcc/testsuite
* gcc.dg/pr95115.c: New test.
gcc/fold-const.cc
gcc/testsuite/gcc.dg/pr95115.c [new file with mode: 0644]