| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -ffold-mem-offsets" } */ |
| 3 |
|
| 4 |
void sink(int arr[3]); |
| 5 |
|
| 6 |
void |
| 7 |
foo(int a, int b, int c, int i) |
| 8 |
{ |
| 9 |
int arr1[3] = {a, b, c}; |
| 10 |
int arr2[3] = {a, c, b}; |
| 11 |
int arr3[3] = {c, b, a}; |
| 12 |
|
| 13 |
arr1[i]++; |
| 14 |
arr2[i]++; |
| 15 |
arr3[i]++; |
| 16 |
|
| 17 |
sink(arr1); |
| 18 |
sink(arr2); |
| 19 |
sink(arr3); |
| 20 |
} |
| 21 |
|
| 22 |
/* The should be no negative memory offsets when using -ffold-mem-offsets. */ |
| 23 |
/* { dg-final { scan-assembler-not "lw\t.*,-.*\\(.*\\)" } } */ |
| 24 |
/* { dg-final { scan-assembler-not "sw\t.*,-.*\\(.*\\)" } } */ |