http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52555
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-15 14:01:34 UTC --- I'd say it is wrong to clear the fast math flags when switching from global state -ffast-math to optimize attrubute -O1 or similar, of course with no outer -ffast-math or -Ofast attribute optimize Ofast should turn fast math options on. How global Ofast with O optimize attribute should behave is another question. Anyway, what happens here is that the ceil[sdx]f2 expanders and others use flag_unsafe_math_optimizations and flag_trapping_math options in their conditions (i.e. HAVE_ceil[sdx]f2 uses those and init_all_optabs sets it). But apparently init_all_optabs is evaluated just once (several times only for really multi targettish targets like mips). Thus it is evaluated when fast math options are on, but during expansion they are off. In this light I'd say it is a target bug to use options that can change between different functions in insn conditions.