[Bug c/123015] __builtin_isnan() should not trigger exception on sNaNs with -fsignaling-nans
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 5 07:19:00 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123015
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |jsm28 at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2025-12-05
Status|UNCONFIRMED |NEW
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is fold_builtin_interclass_mathfn doing
CASE_FLT_FN (BUILT_IN_ISNAN):
case BUILT_IN_ISNAND32:
case BUILT_IN_ISNAND64:
case BUILT_IN_ISNAND128:
{
/* In IBM extended NaN and Inf are encoded in the high-order double
value only. The low-order value is not significant. */
if (is_ibm_extended)
arg = fold_build1_loc (loc, NOP_EXPR, double_type_node, arg);
arg = builtin_save_expr (arg);
tree type = TREE_TYPE (TREE_TYPE (fndecl));
return fold_build2_loc (loc, UNORDERED_EXPR, type, arg, arg);
and for the isnan() case it's likely glibc "interfering".
Confirmed what the reporter says, not sure if that's correct.
isunordered() says it does not raise any flags.
More information about the Gcc-bugs
mailing list