| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
int a[4]; |
| 5 |
int *x, *y, *z; |
| 6 |
|
| 7 |
void foo(void) |
| 8 |
{ |
| 9 |
x = &a[3] - 1; |
| 10 |
y = &a[1] + 1; |
| 11 |
z = 1 + &a[1]; |
| 12 |
} |
| 13 |
|
| 14 |
/* { dg-final { scan-tree-dump-times "&MEM <int> \\\[\\\(void .\\\)&a \\\+ (?:4|8)B\\\]" 3 "optimized" } } */ |
| 15 |
|
| 16 |
|
| 17 |
void bar(int i) |
| 18 |
{ |
| 19 |
x = &a[i] - 1; |
| 20 |
y = &a[i] + 1; |
| 21 |
z = 1 + &a[i]; |
| 22 |
} |
| 23 |
|
| 24 |
/* We can't get &a[i +- 1] in the final code and it is not clear we |
| 25 |
want this. Instead we get to see &a[i] and pointer offsetting |
| 26 |
by 4 and -4U. */ |