aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/dfp/c2x-float-dfp-7.c
blob: dec6b500656c43db7baaf86c0b157708c7b176eb (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
/* Test DEC*_SNAN macros defined in <float.h> with DFP support.  */
/* { dg-do run } */
/* { dg-options "-std=c2x" } */

#include <float.h>

#ifndef DEC32_SNAN
# error "DEC32_SNAN not defined"
#endif

#ifndef DEC64_SNAN
# error "DEC64_SNAN not defined"
#endif

#ifndef DEC128_SNAN
# error "DEC128_SNAN not defined"
#endif

volatile _Decimal32 d32 = DEC32_SNAN;
volatile _Decimal64 d64 = DEC64_SNAN;
volatile _Decimal128 d128 = DEC128_SNAN;

extern void abort (void);
extern void exit (int);

int
main (void)
{
  (void) _Generic (DEC32_SNAN, _Decimal32 : 0);
  if (!__builtin_isnan (DEC32_SNAN))
    abort ();
  if (!__builtin_isnan (d32))
    abort ();
  (void) _Generic (DEC64_SNAN, _Decimal64 : 0);
  if (!__builtin_isnan (DEC64_SNAN))
    abort ();
  if (!__builtin_isnan (d64))
    abort ();
  (void) _Generic (DEC128_SNAN, _Decimal128 : 0);
  if (!__builtin_isnan (DEC128_SNAN))
    abort ();
  if (!__builtin_isnan (d128))
    abort ();
  exit (0);
}