]>
Commit | Line | Data |
---|---|---|
3cfe746f JM |
1 | /* Test INFINITY macro. Test when infinities supported. */ |
2 | /* { dg-do run } */ | |
3 | /* { dg-options "-std=c2x -pedantic-errors" } */ | |
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 | volatile float f = INFINITY; | |
14 | ||
15 | extern void abort (void); | |
16 | extern void exit (int); | |
17 | ||
18 | int | |
19 | main (void) | |
20 | { | |
21 | (void) _Generic (INFINITY, float : 0); | |
22 | if (!(INFINITY > FLT_MAX)) | |
23 | abort (); | |
24 | if (!(f > FLT_MAX)) | |
25 | abort (); | |
26 | exit (0); | |
27 | } |