Re: Gcc floating-point optimizer weird behaviour

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

 



On 2015-01-25 20:51:33 +0300, Vladimir A. Pavlov wrote:
> I have two files (a.c and f.c, look below). In a.c:main() there are two
> variables, d and e, assigned the same function call result. But the
> optimizer causes their values to be different.

Concerning this particular point, I don't think that there is
a guarantee that you will get the same result, even if you use
-fexcess-precision=standard. At least there is no guarantee
from the C standard. Functions can be inlined, and optimizations
can be done in different ways because the context is different.

If you want reproducible results, make sure that IEEE 754 is
supported and that the FP_CONTRACT pragma is set to OFF
(but impossible with GCC: see PR 37845).

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




[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