http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43716
--- Comment #40 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-23 08:12:55 UTC --- tree if-conversion happily executes both arms of the conditional unconditionally with -ffast-math, so for example if (x != 0) tem = y / x; else tem = 0.; ... do sth with tem ... will execute y / x unconditionally based on the fact that it cannot trap. So simply generation of NaNs is not what you should check for, but "usage" of 'tem' with NaN in the above should be (it shouldn't be used if x is zero).