[Bug target/78386] [PPC] Optimization -O2 and higher cause math inconsistency

wschmidt at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 17 15:22:00 GMT 2016


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

Bill Schmidt <wschmidt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #11 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Looks like this is WAD.  From the documentation:

  -ffp-contract=style

  ‘-ffp-contract=off’ disables floating-point expression contraction. ‘-ffp- 
contract=fast’ enables floating-point expression contraction such as forming of
fused multiply-add operations if the target has native support for them.
‘-ffp-contract=on’ enables floating-point expression contraction if allowed by
the language standard. This is currently not implemented and treated equal to
‘-ffp-contract=off’.

  The default is ‘-ffp-contract=fast’.

Also, from internal commentary this default is associated with the default
standard, which is -std=gnu11.  "In strict C standards comformance mode,
consider unpredictable excess precision to mean lack of IEEE 754 support.  The
same applies to unpredictable contraction.  For C++, and outside strict
conformance mode, do not consider these options to mean lack of IEEE 754
support."  This is why using -std=c11, for example, solves the "problem."

Thus, looks like your best option is to use -ffp-contract=off to get the
desired results.

Thanks,
Bill


More information about the Gcc-bugs mailing list