https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110170
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Is that only valid if not trapping math? Gcc defaults to -ftrapping-math . Try disabling it and see if you get that result. Also is that correct for nans?