]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/c2x-float-6.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / c2x-float-6.c
CommitLineData
3cfe746f
JM
1/* Test SNAN macros. */
2/* { dg-do run } */
3/* { dg-options "-std=c2x -pedantic-errors -fsignaling-nans" } */
4/* { dg-add-options ieee } */
5
6#include <float.h>
7
8/* These should be defined if and only if signaling NaNs are supported
9 for the given types. If the testsuite gains effective-target
10 support for targets not supporting signaling NaNs, or not
11 supporting them for all types, this test should be made
12 appropriately conditional. */
13#ifndef FLT_SNAN
14#error "FLT_SNAN undefined"
15#endif
16#ifndef DBL_SNAN
17#error "DBL_SNAN undefined"
18#endif
19#ifndef LDBL_SNAN
20#error "LDBL_SNAN undefined"
21#endif
22
23volatile float f = FLT_SNAN;
24volatile double d = DBL_SNAN;
25volatile long double ld = LDBL_SNAN;
26
27extern void abort (void);
28extern void exit (int);
29
30int
31main (void)
32{
33 (void) _Generic (FLT_SNAN, float : 0);
34 (void) _Generic (DBL_SNAN, double : 0);
35 (void) _Generic (LDBL_SNAN, long double : 0);
36 if (!__builtin_isnan (FLT_SNAN))
37 abort ();
38 if (!__builtin_isnan (f))
39 abort ();
40 if (!__builtin_isnan (DBL_SNAN))
41 abort ();
42 if (!__builtin_isnan (d))
43 abort ();
44 if (!__builtin_isnan (LDBL_SNAN))
45 abort ();
46 if (!__builtin_isnan (ld))
47 abort ();
48 exit (0);
49}