https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123015

            Bug ID: 123015
           Summary: __builtin_isnan() should not  trigger exception on
                    sNaNs  with -fsignaling-nans
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkisuki at tachyum dot com
  Target Milestone: ---

#include <math.h>

int f(float a)
{ 
  return __builtin_isnan(a);
}

int f2(float a)
{ 
  return isnan(a);
}

compiling the above code with gcc -S -O, front end generates:

;; Function f (null)
;; enabled by -tree-original
{ 
  return a unord a;
}


;; Function f2 (null)
;; enabled by -tree-original
{ 
  return a unord a;
}

and compiling with gcc -S -O -fsignaling-nans, front end generates;

;; Function f (null)
;; enabled by -tree-original
{ 
  return a unord a;
}


;; Function f2 (null)
;; enabled by -tree-original
{ 
  return __isnanf (a);
}

With -fsignaling-nans, isnan() is now a call, but __builtin_isnan() is
still "a unord a" and __builtin_isnan() will still trigger an exception on
sNaNs.

Reply via email to