[Bug tree-optimization/126473] [13/14/15/16/17 Regression] Wrong fold of signbit(x) -> x<0 for NaNs with -fno-signed-zeros

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126473

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.5
   Last reconfirmed|                            |2026-07-29
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
            Summary|Wrong fold of signbit(x) -> |[13/14/15/16/17 Regression]
                   |x<0 for NaNs                |Wrong fold of signbit(x) ->
                   |                            |x<0 for NaNs with
                   |                            |-fno-signed-zeros
      Known to work|                            |3.4.6
      Known to fail|                            |4.0.4

--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
r0-56118-gef79730c93540e added it with __builtin_signbit.


It is a regression based on that.
You can reproduce it via `-O1 -g0 -ffast-math -fno-finite-math-only` and:
```
#include <math.h>

__attribute__((noipa)) int
sb (double x)
{
  return signbit (x) != 0;
}
```
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.