| 1 |
/* Test DEC*_SNAN macros. Test requiring runtime exceptions |
| 2 |
support. */ |
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-require-effective-target fenv_exceptions_dfp } */ |
| 5 |
/* { dg-options "-std=c23" } */ |
| 6 |
|
| 7 |
#include <fenv.h> |
| 8 |
#include <float.h> |
| 9 |
|
| 10 |
volatile _Decimal32 d32 = DEC32_SNAN; |
| 11 |
volatile _Decimal64 d64 = DEC64_SNAN; |
| 12 |
volatile _Decimal128 d128 = DEC128_SNAN; |
| 13 |
|
| 14 |
extern void abort (void); |
| 15 |
extern void exit (int); |
| 16 |
|
| 17 |
int |
| 18 |
main (void) |
| 19 |
{ |
| 20 |
feclearexcept (FE_ALL_EXCEPT); |
| 21 |
d32 += d32; |
| 22 |
if (!fetestexcept (FE_INVALID)) |
| 23 |
abort (); |
| 24 |
feclearexcept (FE_ALL_EXCEPT); |
| 25 |
d32 += d32; |
| 26 |
if (fetestexcept (FE_INVALID)) |
| 27 |
abort (); |
| 28 |
feclearexcept (FE_ALL_EXCEPT); |
| 29 |
d64 += d64; |
| 30 |
if (!fetestexcept (FE_INVALID)) |
| 31 |
abort (); |
| 32 |
feclearexcept (FE_ALL_EXCEPT); |
| 33 |
d64 += d64; |
| 34 |
if (fetestexcept (FE_INVALID)) |
| 35 |
abort (); |
| 36 |
feclearexcept (FE_ALL_EXCEPT); |
| 37 |
d128 += d128; |
| 38 |
if (!fetestexcept (FE_INVALID)) |
| 39 |
abort (); |
| 40 |
feclearexcept (FE_ALL_EXCEPT); |
| 41 |
d128 += d128; |
| 42 |
if (fetestexcept (FE_INVALID)) |
| 43 |
abort (); |
| 44 |
exit (0); |
| 45 |
} |