aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/dfp/c2x-float-dfp-6.c
blob: 4533c61e8e9808f3e70e4fca56c44b3a5b8c7e2d (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
/* Test DEC_NAN macro.  Runtime exceptions test, to verify NaN is
   quiet not signaling.  (This would only actually fail for a
   signaling NaN in the hardware DFP case, because the software DFP
   support in libgcc does not integrate with hardware exceptions.)  */
/* { dg-do run } */
/* { dg-require-effective-target fenv_exceptions } */
/* { dg-options "-std=c2x" } */

#include <fenv.h>
#include <float.h>

#ifndef DEC_NAN
# error "DEC_NAN not defined"
#endif

volatile _Decimal32 d = DEC_NAN;

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

int
main (void)
{
  d += d;
  if (fetestexcept (FE_INVALID))
    abort ();
  exit (0);
}