[Bug tree-optimization/126535] New: [14/15/16/17 Regression] Wrong code with ranger and islessgreater

"ktkachov 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=126535

            Bug ID: 126535
           Summary: [14/15/16/17 Regression] Wrong code with ranger and
                    islessgreater
           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)) int
g (double x, int i)
{
  double a = (double) ((i & 3) - 1);
  double y = __builtin_sqrt (a);

  if (__builtin_islessgreater (x, y))   /* x LTGT y; the false edge is UNEQ */
    return 3;
  if (x > 100.0)
    return 1;
  return 2;
}

int
main (void)
{
  if (g (1e9, 0) != 1)
    __builtin_abort ();
  return 0;
}

aborts on aarch64 at -O2 -lm and passes with -O0
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.