https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90356
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The rules for + 0.0 say that: for non-zero x, x + (+/-0.0) = x 0.0 + 0.0 = 0.0 -0.0 + (-0.0) = -0.0 -0.0 + 0.0 = 0.0 unless rounding towards negative infinity, in that case it is -0.0. So, for -frounding-math we can't optimize this, but with just -fsigned-zeros I think we could optimize (x + 0.0) + 0.0 to x + 0.0 and (x + (-0.0)) + (-0.0) to x + (-0.0), because if x is non-zero, then the result will be still non-zero, when not rounding towards negative infinity and if x is 0.0, the result will still be 0.0 and when not rounding towards negative infinity and if x is -0.0 the result will still be 0.0 in the first case and -0.0 in the latter case.