[Bug middle-end/84891] -fno-signed-zeros leads to optimization which should be possible only if also -ffinite-math-only is on

noone@turm-lahnstein.de gcc-bugzilla@gcc.gnu.org
Mon Mar 19 12:18:00 GMT 2018


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

--- Comment #4 from ead <noone@turm-lahnstein.de> ---
From my naive point of view:

   - The c++ standard doesn't define how complex-number-multiplication should
work, it is implementation defined/gcc-specific (I'm not a standard-scholar, so
might be very wrong about it).

   - One can deduce from the results in the IEEE 754 mode, how this
multiplication (implementation-defined and gcc-specific) is implemented.

   - One's expectation with -fno-signed-zeros is that only transformations
which honor infs/nans can be performed by the optimizer. Clearly, we cannot
refer to the standard to see, what the result with -fno-signed-zeros should be,
because -fno-signed-zeros is not covered by standard, but is a gcc-specific
option.

So in this case, the effect of -fno-signed-zeros is not covered by the
description in the man-pages (at least as I understand that):



    -fno-signed-zeros

    Allow optimizations for floating point arithmetic that ignore the
signedness of zero. IEEE arithmetic specifies the behavior of distinct +0.0 and
-0.0 values, which then prohibits simplification of expressions such as x+0.0
or 0.0*x (even with -ffinite-math-only). This option implies that the sign of a
zero result isn't significant.

    The default is -fsigned-zeros.


More information about the Gcc-bugs mailing list