[Bug c/104389] [10/11/12 Regression] HUGE_VAL * 0.0 is no longer a NaN

2022-02-04 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389

--- Comment #4 from Jakub Jelinek  ---
Ah, of course it isn't NAN, it is infinity, but +-Inf * 0 is still NAN.

[Bug c/104389] [10/11/12 Regression] HUGE_VAL * 0.0 is no longer a NaN

2022-02-04 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389

--- Comment #3 from Jakub Jelinek  ---
Changing it to
double
foo (void)
{
  double a = __builtin_huge_val ();
  return a * 0.0;
}
shows ccp1 applies
/* Maybe fold x * 0 to 0.  The expressions aren't the same
   when x is NaN, since x * 0 is also NaN.  Nor are they the
   same in modes with signed zeros, since multiplying a
   negative value by 0 gives -0, not +0.  */
(simplify
 (mult @0 real_zerop@1)
 (if (!tree_expr_maybe_nan_p (@0)
  && !tree_expr_maybe_real_minus_zero_p (@0)
  && !tree_expr_maybe_real_minus_zero_p (@1))
  @1))
So the question is why tree_expr_maybe_nan_p isn't true.

[Bug c/104389] [10/11/12 Regression] HUGE_VAL * 0.0 is no longer a NaN

2022-02-04 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389

Jakub Jelinek  changed:

   What|Removed |Added

   Last reconfirmed||2022-02-04
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #2 from Jakub Jelinek  ---
double foo (void) { return __builtin_huge_val () * 0.0; }
folds since r12-6959 to return 0.0 instead of return NAN; already in original
dump.

[Bug c/104389] [10/11/12 Regression] HUGE_VAL * 0.0 is no longer a NaN

2022-02-04 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org
   Priority|P3  |P1
   Target Milestone|--- |10.4
Summary|HUGE_VAL * 0.0 is no longer |[10/11/12 Regression]
   |a NaN   |HUGE_VAL * 0.0 is no longer
   ||a NaN

--- Comment #1 from Jakub Jelinek  ---
Started with r12-6959-g34afa19d29c5bf0b0f504e4d0aca4e9a8bc82c5c
which has been backported to 10/11 as well.