| 1 |
/* Test DEC_NAN macro. Runtime exceptions test, to verify NaN is |
| 2 |
quiet not signaling. (This would only actually fail for a |
| 3 |
signaling NaN in the hardware DFP case, because the software DFP |
| 4 |
support in libgcc does not integrate with hardware exceptions.) */ |
| 5 |
/* { dg-require-effective-target fenv_exceptions } */ |
| 6 |
/* { dg-options "-std=c23" } */ |
| 7 |
|
| 8 |
#include <fenv.h> |
| 9 |
#include <float.h> |
| 10 |
|
| 11 |
#ifndef DEC_NAN |
| 12 |
# error "DEC_NAN not defined" |
| 13 |
#endif |
| 14 |
|
| 15 |
volatile _Decimal32 d = DEC_NAN; |
| 16 |
|
| 17 |
extern void abort (void); |
| 18 |
extern void exit (int); |
| 19 |
|
| 20 |
int |
| 21 |
main (void) |
| 22 |
{ |
| 23 |
d += d; |
| 24 |
if (fetestexcept (FE_INVALID)) |
| 25 |
abort (); |
| 26 |
exit (0); |
| 27 |
} |