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

            Bug ID: 111701
           Summary: [11/12/13/14 Regression] wrong code for
                    __builtin_signbit(x*x)
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
                CC: amonakov at gcc dot gnu.org, eggert at cs dot ucla.edu,
                    rguenth at gcc dot gnu.org, unassigned at gcc dot gnu.org
        Depends on: 111655
  Target Milestone: ---
            Target: x86_64-linux-gnu

+++ This bug was initially created as a clone of Bug #111655 +++

See bug 111655 comment 11: we incorrectly deduce nonnegative_p for
floating-point 'x * x', and the following aborts:

__attribute__((noipa))
static int f(float *x)
{
    *x *= *x;
    return __builtin_signbit(*x);
}

int main()
{
    float x = -__builtin_nan("");
    int s = f(&x);
    if (s != __builtin_signbit(x))
        __builtin_abort();
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655
[Bug 111655] [11/12/13/14 Regression] wrong code generated for
__builtin_signbit and 0./0. on x86-64 -O2

Reply via email to