http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55939
Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org --- Comment #21 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2013-02-18 19:38:40 UTC --- Another less invasive option could be to force the return value of my_ldexp() to go through memory, thus chopping off the excess precision before returning: --- a.c 2013-02-18 20:37:23.000000000 +0100 +++ b.c 2013-02-18 20:36:42.000000000 +0100 @@ -404,7 +404,11 @@ e += 1; } } else - return d; + { + volatile double force_round = d; + return force_round; + + } } } But basically, you'd have to carefully keep track of when you have to use volatiles.