Re: difference in calculation result when using gcc vs Visual studio and optimisation flag

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

 



On 26 April 2018 at 10:26, Jack Andrews wrote:
>>
> 2.       When optimization in gcc  are disabled, then there is no
>
> difference
>
> This reduces it to a one-platform problem.  gcc -O different to gcc
> Maybe I'm being idealistic, but why should optimization change results?

FP operations are sensitive to the order they're performed in, because
FP numbers are not exact.

Another possible reason is because optimization changes register
usage, causing registers to be spilled to memory, and x86 floating
point registers have excess precision (80 bits not 64). This is
similar to the effects of the -ffloat-store option:
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-ffloat-store



[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