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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|16.2                        |13.5
            Summary|[16/17 Regression] Wrong    |[16/17 Regression] Wrong
                   |code with ranger and FP     |code with ranger and FP
                   |comparisons and NaN         |comparisons and NaN
                   |handling since r16-1191     |handling since r13-1933

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
With the following adjusted testcase it started at -O2 with
r13-1933-g24012539ae3410174b3e755b580a16de826d56a6
__attribute__((noipa)) int
f (double x, double a, double z)
{
  if (z >= 0.5 && z <= 7.5) {
  if (a >= -1.0 && a <= 2.0) {
  if (x >= 0.0 && x <= 7.0) {
  double y = __builtin_sqrt (a);

  if (y < x)
    return 0;
  /* claimed by op1_op2_relation: y >= x */
  if (z < y)
    return 1;
  /* claimed: z >= y, so transitively z >= x */
  if (z >= x)
    return 2;
  return 3;
  } } }
  return -1;
}

int
main (void)
{
  /* y = sqrt (-1.0) = NaN, so both y < x and z < y are false.
     x = 7.0, z = 0.5, and 0.5 >= 7.0 is false.  */
  if (f (7.0, -1.0, 0.5) != 3)
    __builtin_abort ();
  return 0;
}

Reply via email to