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

            Bug ID: 126467
           Summary: wrong code with folding 0.0 - x
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

__attribute__((noipa)) double
f (double y)
{
  return 0.0 - __builtin_fabs (y);
}

int
main (void)
{
  if (__builtin_signbit (f (-0.0)))
    __builtin_abort ();
  if (__builtin_signbit (f (0.0)))
    __builtin_abort ();
  return 0;
}

aborts with GCC but passes with Clang.
 0.0 - x is not -x: for x == +0.0 the subtraction gives +0.0 while the negation
gives -0.0

Reply via email to