April 29, 2023
https://issues.dlang.org/show_bug.cgi?id=23867

          Issue ID: 23867
           Summary: ImportC: undefined identifier `__builtin_isnan`
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: lance@lancebachmeier.com

The failing C code is

if (ISNAN(df) || df <= 0.0)     ML_WARN_return_NAN;

The ISNAN macro is defined with these lines

/* If isnan is a macro, as C99 specifies, the C++
   math header will undefine it. This happens on macOS */
# ifdef __cplusplus
  int R_isnancpp(double); /* in mlutils.c */
#  define ISNAN(x)     R_isnancpp(x)
# else
#  define ISNAN(x)     (isnan(x)!=0)
# endif

Looking at the gcc preprocessor output, this

if (ISNAN(df) || df <= 0.0)

expands to

if ((__builtin_isnan (Rf_df)!=0) || Rf_df <= 0.0)

--