See <http://gcc.gnu.org/ml/gcc-help/2006-09/msg00232.html>.
Disassembling the code suggests that, using gcc-4.1,2, both calls to fetestexcept(3) mysteriously happened before the division when optimization is turned on. This was not the case with earlier versions of gcc, where the calls to fetestexcept(3) bracket the fdivl instruction. -- Summary: optimzation breaks floating point exception flag reading Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kreckel at ginac dot de GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29186