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