gcc/testsuite/gcc.dg/torture/pr85989.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | #define N 9 |
| 4 | |
| 5 | void __attribute__((noipa)) |
| 6 | f (double x, double y, double *res) |
| 7 | { |
| 8 | y = -y; |
| 9 | for (int i = 0; i < N; ++i) |
| 10 | { |
| 11 | double tmp = y; |
| 12 | y = x; |
| 13 | x = tmp; |
| 14 | res[i] = i; |
| 15 | } |
| 16 | res[N] = y * y; |
| 17 | res[N + 1] = x; |
| 18 | } |
| 19 | |
| 20 | int |
| 21 | main (void) |
| 22 | { |
| 23 | double res[N + 2]; |
| 24 | f (10, 20, res); |
| 25 | for (int i = 0; i < N; ++i) |
| 26 | if (res[i] != i) |
| 27 | __builtin_abort (); |
| 28 | if (res[N] != 100 || res[N + 1] != -20) |
| 29 | __builtin_abort (); |
| 30 | return 0; |
| 31 | } |