| 1 |
/* { dg-options "-O2 -fdump-tree-modref1" } */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
__attribute__((noinline)) |
| 4 |
void a(char *ptr, char *ptr2) |
| 5 |
{ |
| 6 |
(*ptr)++; |
| 7 |
(*ptr2)++; |
| 8 |
} |
| 9 |
|
| 10 |
__attribute__((noinline)) |
| 11 |
void b(char *ptr) |
| 12 |
{ |
| 13 |
a(ptr+1,&ptr[3]); |
| 14 |
} |
| 15 |
|
| 16 |
int main() |
| 17 |
{ |
| 18 |
char c[5]={0,1,2,0,0}; |
| 19 |
b(c); |
| 20 |
return c[0]+c[4]; |
| 21 |
} |
| 22 |
/* Check that both param offsets are determined correctly and the computation |
| 23 |
is optimized out. */ |
| 24 |
/* { dg-final { scan-tree-dump "param offset:1" "modref1" } } */ |
| 25 |
/* { dg-final { scan-tree-dump "param offset:3" "modref1" } } */ |
| 26 |
/* { dg-final { scan-tree-dump "return 0" "modref1" } } */ |