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

--- Comment #7 from kargls at comcast dot net ---
(In reply to Richard Biener from comment #3)
> You can get the desired behavior with -fno-signed-zeros I think - it might
> be reasonable to add an additional -fcx-* flag specifying that just for
> _Complex
> operations signed zeros can be ignored (IIRC non-complex REAL have specified
> behavior wrt signed zeros, so a -fno-signed-zeros default for Fortran would
> be wrong).
> 
> So, -fcx-no-signed-zeros or maybe simply alter -fcx-fortran-rules to cover
> signed zeros?

It my opinion that -fcx-fortran-rules should be removed.  It's exist
does match anything specified in the Fortran standard.  But that's
for another PR.

It is more than just adding a new option.

   program testprogram

   implicit none

   real, parameter :: rc = sign(0., -1.)
   complex, parameter :: zc = nzero * (0, 1)
   real r 
   complex z

   print *, rc, zc

   r = sign(0., -1.)
   z = r * (0, 1)
   print *, r, z

  end program 

% gfcx -o z -O a.f90 && ./z
  -0.00000000                (-0.00000000,0.00000000)
  -0.00000000                (-0.00000000,0.00000000)
% gfcx -o z -Ofast a.f90 && ./z
  -0.00000000                (-0.00000000,0.00000000)
  -0.00000000               (-0.00000000,-0.00000000)

Reply via email to