https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95115
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Xi Ruoyao <xry...@gcc.gnu.org>: https://gcc.gnu.org/g:9c9494533a78df07f2b32097fe1e78f68369dc94 commit r10-10432-g9c9494533a78df07f2b32097fe1e78f68369dc94 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.c (const_binop): Do not fold NaN result from non-NaN operands. gcc/testsuite * gcc.dg/pr95115.c: New test. (cherry picked from commit 34afa19d29c5bf0b0f504e4d0aca4e9a8bc82c5c)