https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104045
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- Folding the fmax operation should be valid in the absence of -fsignaling-nans (fmax (a, +Inf) should return +Inf without raising any exceptions, for any x not a signaling NaN). However, replacing the division with the constant +Inf is only valid with -fno-trapping-math (though it would be OK by default to use the fact that the result is +Inf in optimizing the fmax call, as long as the division itself doesn't get removed so the divide-by-zero exception is preserved).