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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
a = -2.5118280672773279e+307
c = 1.7976931348623157e+308
c is in particular the maximum normalized number, __DBL_MAX__, binary
0x7fefffffffffffff.
126       z = a + c;
z = 1.546510328134583e+308

and that is finite.

144           q = a - z;

But this is -inf.
145           zz = q + c + (a - (q + z)) + aa + cc;
and everything goes downhill from there, as a, c, z, aa and cc are all finite,
but q is -inf and a - (-inf + finite) is +inf and -inf + +inf is nan.

So, the code:
  z = a + c;

  if (nonfinite (z))
    {
...
    }
  else
    {
      q = a - z;
would need another if (nonfinite (q)) check after computation of q (and I don't
believe it could just compute q = a - z; right after z = a + c; and replace if
(nonfinite (z)) with if (nonfinite (q)) because if a is +-inf and c is finite,
z will be +-inf and q will be nan.

Reply via email to