https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Changing it to double foo (void) { double a = __builtin_huge_val (); return a * 0.0; } shows ccp1 applies /* Maybe fold x * 0 to 0. The expressions aren't the same when x is NaN, since x * 0 is also NaN. Nor are they the same in modes with signed zeros, since multiplying a negative value by 0 gives -0, not +0. */ (simplify (mult @0 real_zerop@1) (if (!tree_expr_maybe_nan_p (@0) && !tree_expr_maybe_real_minus_zero_p (@0) && !tree_expr_maybe_real_minus_zero_p (@1)) @1)) So the question is why tree_expr_maybe_nan_p isn't true.