gcc/testsuite/gcc.dg/c23-float-2.c
raw| 1 | /* Test INFINITY macro. Generic test. */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-std=c23 -w" } */ |
| 4 | /* { dg-add-options ieee } */ |
| 5 | /* { dg-require-effective-target inff } */ |
| 6 | |
| 7 | #include <float.h> |
| 8 | |
| 9 | #ifndef INFINITY |
| 10 | #error "INFINITY undefined" |
| 11 | #endif |
| 12 | |
| 13 | extern void abort (void); |
| 14 | extern void exit (int); |
| 15 | |
| 16 | int |
| 17 | main (void) |
| 18 | { |
| 19 | (void) _Generic (INFINITY, float : 0); |
| 20 | if (!(INFINITY >= FLT_MAX)) |
| 21 | abort (); |
| 22 | exit (0); |
| 23 | } |