(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
dfp/
builtin-snan-2.c
       1  /* Test __builtin_nansd* functions.  Test requiring runtime exceptions
       2     support.  */
       3  /* { dg-do run } */
       4  /* { dg-require-effective-target fenv_exceptions_dfp } */
       5  /* { dg-options "" } */
       6  
       7  #include <fenv.h>
       8  
       9  volatile _Decimal32 d32 = __builtin_nansd32 ("");
      10  volatile _Decimal64 d64 = __builtin_nansd64 ("");
      11  volatile _Decimal128 d128 = __builtin_nansd128 ("");
      12  
      13  extern void abort (void);
      14  extern void exit (int);
      15  
      16  int
      17  main (void)
      18  {
      19    feclearexcept (FE_ALL_EXCEPT);
      20    d32 += d32;
      21    if (!fetestexcept (FE_INVALID))
      22      abort ();
      23    feclearexcept (FE_ALL_EXCEPT);
      24    d32 += d32;
      25    if (fetestexcept (FE_INVALID))
      26      abort ();
      27    feclearexcept (FE_ALL_EXCEPT);
      28    d64 += d64;
      29    if (!fetestexcept (FE_INVALID))
      30      abort ();
      31    feclearexcept (FE_ALL_EXCEPT);
      32    d64 += d64;
      33    if (fetestexcept (FE_INVALID))
      34      abort ();
      35    feclearexcept (FE_ALL_EXCEPT);
      36    d128 += d128;
      37    if (!fetestexcept (FE_INVALID))
      38      abort ();
      39    feclearexcept (FE_ALL_EXCEPT);
      40    d128 += d128;
      41    if (fetestexcept (FE_INVALID))
      42      abort ();
      43    exit (0);
      44  }