https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106785
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Well, __builtin_nan ("") == xxx is always false even with -fno-finite-math-only, including NaN == NaN, that is how floating point equality comparisons are defined. But, e.g. with -ffinite-math-only, we fold __builtin_isinf (x) or __builtin_isnan (x) to 0 (maybe with the exception if you use __builtin_nan ("") as its operand?; but that just shows that it is UB if NaNs or Infs can appear at runtime).