gcc/testsuite/gcc.dg/pr95115.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O2 -ftrapping-math" } */ |
| 3 | /* { dg-add-options ieee } */ |
| 4 | /* { dg-require-effective-target fenv_exceptions_double } */ |
| 5 | |
| 6 | #include <fenv.h> |
| 7 | #include <stdlib.h> |
| 8 | |
| 9 | __attribute__ ((noipa)) double |
| 10 | x (void) |
| 11 | { |
| 12 | double d = __builtin_inf (); |
| 13 | return d / d; |
| 14 | } |
| 15 | |
| 16 | int |
| 17 | main (void) |
| 18 | { |
| 19 | double r = x (); |
| 20 | if (!__builtin_isnan (r)) |
| 21 | abort (); |
| 22 | if (!fetestexcept (FE_INVALID)) |
| 23 | abort (); |
| 24 | exit (0); |
| 25 | } |