https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105480
--- Comment #12 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- __builtin_isnan must not raise "invalid" for signaling NaN arguments. __builtin_isunordered (i.e. UNORDERED / UNORDERED_EXPR; standard macro isunordered) must raise "invalid" for signaling NaN arguments. The -ftrapping-math option (which is on by default) means code transformations that either add or remove exceptions should be avoided (though this isn't implemented very consistently, especially as regards transformations that remove exceptions). Thus, transforming in either direction between __builtin_isnan and UNORDERED_EXPR is undesirable given -ftrapping-math -fsignaling-nans. Given -fno-trapping-math or (default) -fno-signaling-nans, the transformation is OK.