modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr39228.c (about)

     1  /* { dg-add-options ieee } */
     2  /* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
     3  
     4  extern void abort (void);
     5  
     6  static inline int __attribute__((always_inline)) testf (float b)
     7  {
     8    float c = 1.01f * b;
     9  
    10    return __builtin_isinff (c);
    11  }
    12  
    13  static inline int __attribute__((always_inline)) test (double b)
    14  {
    15    double c = 1.01 * b;
    16  
    17    return __builtin_isinf (c);
    18  }
    19  
    20  static inline int __attribute__((always_inline)) testl (long double b)
    21  {
    22    long double c = 1.01L * b;
    23  
    24    return __builtin_isinfl (c);
    25  }
    26  
    27  int main()
    28  {
    29    if (testf (__FLT_MAX__) < 1)
    30      abort ();
    31  
    32    if (test (__DBL_MAX__) < 1)
    33      abort ();
    34  
    35    if (testl (__LDBL_MAX__) < 1)
    36      abort ();
    37  
    38    return 0;
    39  }