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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2008-12-11 21:22:46         |2016-8-30
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Still an issue:

#include <math.h>
#include <complex.h>

int main()
{
    float complex c,d;
    foo(&c);
    d=1.0f/c;
    return creal(d)+cimag(d)<0;
}

Using -fcx-fortran-rules yields (from the optimized dump)

  _13 = REALPART_EXPR <c>;
  _14 = IMAGPART_EXPR <c>;
  _15 = ABS_EXPR <_13>;
  _16 = ABS_EXPR <_14>;
  if (_15 < _16)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  _18 = _13 / _14;
  _19 = _13 * _18;
  _20 = _14 + _19;
  _21 = _18 + 0.0;
  _22 = _18 * 0.0;
  _23 = _22 - 1.0e+0;
  _24 = _21 / _20;
  _25 = _23 / _20;
  goto <bb 5>;

  <bb 4>:
  _26 = _14 / _13;
  _27 = _14 * _26;
  _28 = _13 + _27;
  _29 = _26 * 0.0;
  _30 = _29 + 1.0e+0;
  _31 = 0.0 - _26;
  _32 = _30 / _28;
  _33 = _31 / _28;


I do not think it is possible to create a NaN/Inf situation here
where just ignoring the imaginary zero is wrong.

Reply via email to