https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Xi Ruoyao <xry...@gcc.gnu.org>: https://gcc.gnu.org/g:34afa19d29c5bf0b0f504e4d0aca4e9a8bc82c5c commit r12-6959-g34afa19d29c5bf0b0f504e4d0aca4e9a8bc82c5c Author: Xi Ruoyao <xry...@mengyan1223.wang> Date: Mon Jan 31 01:15:20 2022 +0800 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.