Re: -ffloat-store behavior (Re: Susprising behavior of gcc on x86 (-m32))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9 September 2015 at 09:18, Mathieu Malaterre <malat@xxxxxxxxxx> wrote:
>> Thanks for the link. However -in my case- the compile option
>> `-fexcess-precision=standard` does produce the same code as
>> `-ffloat-store`. At least for
>
> Meant to say `does not produce`

The FAQ now says: "(whether this option has effect or not depends on
other options, please read the manual entry for -fexcess-precision=
carefully)."

The manual says: "-fexcess-precision=standard is not implemented for
languages other than C, and has no effect if
-funsafe-math-optimizations or -ffast-math is specified. On the x86,
it also has no effect if -mfpmath=sse or -mfpmath=sse+387 is
specified; in the former case, IEEE semantics apply without excess
precision, and in the latter, rounding is unpredictable"

>
>> [...]
>> double div; /* OPJ_FLOAT64 */
>> div = dd / dr;
>> if (div >= thresh)
>> [...]
>>
>> Is there a longer description for `-fexcess-precision=standard` which
>> explains case of failures ?

The manual says: "if -fexcess-precision=standard is specified then
excess precision follows the rules specified in ISO C99; in
particular, both casts and assignments cause values to be rounded to
their semantic types (whereas -ffloat-store only affects
assignments)."

The FAQ says: "Floating-point results may still depend on the
optimization level and target architecture in some cases that are
allowed by the ISO C standard. For instance, different sets of
instructions may be used for code such as x*y+z depending on the
target architecture and the optimization level, and this difference
may change the results."

I don't have a list of cases allowed by the standard. If you know more
examples, we could add them to the answer.

> From a clean debian/sid 32bits chroot I can no longer reproduce this.
> In summary:
>
> 1. removed -ffast-math
> 2. add -std=c99
> 3. Change the code for an explicit storage of division (div = dd / dr)
> => issue solved !

The manual says: "This option is enabled by default for C if a strict
conformance option such as -std=c99 is used." Thus, you are in fact
using -fexcess-precision=standard.

That only means that floating-point computations will follow ISO C
rules. FAQ: "Floating-point results may still depend on the
optimization level and target architecture".

Cheers,

Manuel.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux