https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106165
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- -fexcess-precision=standard (-std=c99 enables -fexcess-precision=standard) or -mfpmath=sse fixes the issue. This is not wrong code but rather the way x87 works for GCC. GCC defaults to using the execess precision of x87 (80bits) and sometimes if the floating point value is kept on the fpu stack, there is no rounding back to 64bits. And that is exactly what you are seeing here really. Anyways this is a dup of bug 323. The reason why it works for the non-inline floor case is because well there is a rounding step that happens. The reason why -fexcess-precision=standard works (it is only implemented for the C front-end) is because there rounding steps are now explict in the IR and will use the 80bit fpu and then force the rounding back. The reason why -mfpmath=sse works is instead of using x87, GCC will use the sse fpu implementation which is 64bit without excess precision. This is kinda not a bug, just you not understanding fpu and execess precision. *** This bug has been marked as a duplicate of bug 323 ***