[Bug tree-optimization/126547] [13/14/15/16/17 Regression] Wrong code with ranger and FP division and infinities since r13-4492

"jakub 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=126547

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|16.2                        |13.5
   Last reconfirmed|                            |2026-07-31
            Summary|[16/17 Regression] Wrong    |[13/14/15/16/17 Regression]
                   |code with ranger and FP     |Wrong code with ranger and
                   |division and infinities     |FP division and infinities
                   |since r16-1191              |since r13-4492
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, e.g. changing the testcase to (still -O2):
__attribute__((noipa)) static int
f (long double a1, long double a2)
{
  if (a1 >= 1.0 && a1 <= 8.0) {
  long double d = a1 / a2;
  int n = 0;
  if (d >= __builtin_infl ())
    n += 1;
  if (a2 > 0.0L)
    n += 2;
  return n;
  } else
    return -1;
}

int
main (void)
{
  int r = f (1.0, __LDBL_DENORM_MIN__);   /* 1.0L / 6.5e-4966L == +Inf */
  __builtin_printf ("%d\n", r);
  if (r != 3)
    __builtin_abort ();
  return 0;
}
started with r13-4492-g4500baaccb6e4d696e223c338bbdf7705c3646dd
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.