https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126467

--- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> ---
The problem is with the transformation at line 5916 of match.pd:

/* (ARG0 - ARG1) is the same as (-ARG1 + ARG0).  So check whether
   ARG0 is zero and X + ARG0 reduces to X, since that would mean
   (-ARG1 + ARG0) reduces to -ARG1.  */
(simplify
 (minus real_zerop@0 @1)
 (if (fold_real_zero_addition_p (type, @1, @0, 0))
  (negate @1)))

The problem is that "x - y" is not the same as "(-y) + x" in IEEE FP,
i.e. the first sentence/statement of the comment is incorrect, so it's
inappropriate to use fold_real_zero_addition_p here.  Instead it needs
to check that y can't be zero (or signaling NaN).  Technically, if
x is +0.0, it's OK for y to be -0.0.

Reply via email to