| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-add-options ieee } */ |
| 3 |
/* { dg-require-effective-target fenv_exceptions_double } */ |
| 4 |
|
| 5 |
#include <fenv.h> |
| 6 |
|
| 7 |
extern void abort (void); |
| 8 |
extern void exit (int); |
| 9 |
|
| 10 |
double __attribute__ ((noinline, noclone)) |
| 11 |
foo (double x) |
| 12 |
{ |
| 13 |
if (__builtin_islessequal (x, 0.0) || __builtin_isgreater (x, 1.0)) |
| 14 |
return x + x; |
| 15 |
return x * x; |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
main (void) |
| 20 |
{ |
| 21 |
volatile double x = foo (__builtin_nan ("")); |
| 22 |
if (fetestexcept (FE_INVALID)) |
| 23 |
abort (); |
| 24 |
exit (0); |
| 25 |
} |