gcc/testsuite/gcc.c-torture/execute/pr107879.c
raw| 1 | /* PR tree-optimization/107879 */ |
| 2 | |
| 3 | __attribute__((noipa)) static double |
| 4 | foo (double *y) |
| 5 | { |
| 6 | volatile int ph = 0; |
| 7 | volatile double vf = 1.0; |
| 8 | double factor = vf; |
| 9 | double x = - (double) ph * factor; |
| 10 | if (x == 0) |
| 11 | *y = 1.0; |
| 12 | else |
| 13 | *y = 1.0 / x; |
| 14 | double w = 2.0 * x / factor; |
| 15 | double omww = 1 - w; |
| 16 | return omww > 0.0 ? omww : 0.0; |
| 17 | } |
| 18 | |
| 19 | int |
| 20 | main () |
| 21 | { |
| 22 | double y = 42.0; |
| 23 | if (foo (&y) != 1.0) |
| 24 | __builtin_abort (); |
| 25 | } |