https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114140
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> --- It's the old argument on whether isnan(NaN) should return true or false with -ffinite-math-only. With what we currently do "constant folding" sNaN into NaN would be correct with -fno-signalling-nans, likewise constant folding Inf into 42.0 is "correct" for -ffinite-math-only. You are basically invoking undefined beavior when introducing sNaN into a program without using -fsignalling-nans.