| 1 |
/* PR rtl-optimization/39794 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-O2 -funroll-loops" } */ |
| 4 |
|
| 5 |
extern void abort (); |
| 6 |
|
| 7 |
void |
| 8 |
foo (int *a, int n) |
| 9 |
{ |
| 10 |
int i; |
| 11 |
for (i = 0; i < n; i++) |
| 12 |
{ |
| 13 |
a[i] *= 2; |
| 14 |
a[i + 1] = a[i - 1] + a[i - 2]; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
int a[16]; |
| 19 |
int ref[16] = { 0, 1, 4, 2, 10, 12, 24, 44, |
| 20 |
72, 136, 232, 416, 736, 1296, 2304, 2032 }; |
| 21 |
|
| 22 |
int |
| 23 |
main () |
| 24 |
{ |
| 25 |
int i; |
| 26 |
for (i = 0; i < 16; i++) |
| 27 |
a[i] = i; |
| 28 |
foo (a + 2, 16 - 3); |
| 29 |
for (i = 0; i < 16; i++) |
| 30 |
if (ref[i] != a[i]) |
| 31 |
abort (); |
| 32 |
return 0; |
| 33 |
} |