https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:b3763384a1f696260f3ee7bda8c0e7e4ad732ad9 commit r12-7072-gb3763384a1f696260f3ee7bda8c0e7e4ad732ad9 Author: Jakub Jelinek <ja...@redhat.com> Date: Sat Feb 5 10:52:19 2022 +0100 match.pd: Fix x * 0.0 -> 0.0 folding [PR104389] The recent PR95115 change to punt in const_binop on folding operation with non-NaN operands into NaN if flag_trapping_math broke the following testcase, because the x * 0.0 simplification punts just if x maybe a NaN (because NaN * 0.0 is NaN not 0.0) or if one of the operands could be negative zero. But Inf * 0.0 or -Inf * 0.0 is also NaN, not 0.0, so when NaNs are honored we need to punt for possible infinities too. 2022-02-05 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/104389 * match.pd (x * 0 -> 0): Punt if x maybe infinite and NaNs are honored. * gcc.dg/pr104389.c: New test.