| 1 |
/* Test DEC*_SNAN macros defined in <float.h> with DFP support. */ |
| 2 |
/* { dg-options "-std=c23" } */ |
| 3 |
|
| 4 |
#include <float.h> |
| 5 |
|
| 6 |
#ifndef DEC32_SNAN |
| 7 |
# error "DEC32_SNAN not defined" |
| 8 |
#endif |
| 9 |
|
| 10 |
#ifndef DEC64_SNAN |
| 11 |
# error "DEC64_SNAN not defined" |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifndef DEC128_SNAN |
| 15 |
# error "DEC128_SNAN not defined" |
| 16 |
#endif |
| 17 |
|
| 18 |
volatile _Decimal32 d32 = DEC32_SNAN; |
| 19 |
volatile _Decimal64 d64 = DEC64_SNAN; |
| 20 |
volatile _Decimal128 d128 = DEC128_SNAN; |
| 21 |
|
| 22 |
extern void abort (void); |
| 23 |
extern void exit (int); |
| 24 |
|
| 25 |
int |
| 26 |
main (void) |
| 27 |
{ |
| 28 |
(void) _Generic (DEC32_SNAN, _Decimal32 : 0); |
| 29 |
if (!__builtin_isnan (DEC32_SNAN)) |
| 30 |
abort (); |
| 31 |
if (!__builtin_isnan (d32)) |
| 32 |
abort (); |
| 33 |
(void) _Generic (DEC64_SNAN, _Decimal64 : 0); |
| 34 |
if (!__builtin_isnan (DEC64_SNAN)) |
| 35 |
abort (); |
| 36 |
if (!__builtin_isnan (d64)) |
| 37 |
abort (); |
| 38 |
(void) _Generic (DEC128_SNAN, _Decimal128 : 0); |
| 39 |
if (!__builtin_isnan (DEC128_SNAN)) |
| 40 |
abort (); |
| 41 |
if (!__builtin_isnan (d128)) |
| 42 |
abort (); |
| 43 |
exit (0); |
| 44 |
} |