| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-fdump-tree-ealias-details -Wno-attributes" } */ |
| 3 |
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ |
| 4 |
|
| 5 |
struct X |
| 6 |
{ |
| 7 |
long l1; |
| 8 |
struct Y |
| 9 |
{ |
| 10 |
long l2; |
| 11 |
int *p; |
| 12 |
} y; |
| 13 |
}; |
| 14 |
int i; |
| 15 |
static int __attribute__((always_inline)) |
| 16 |
foo (struct X *x) |
| 17 |
{ |
| 18 |
struct Y y = x->y; |
| 19 |
/* In the inlined instance the dereferenced pointer needs to point to i. */ |
| 20 |
*y.p = 0; |
| 21 |
i = 1; |
| 22 |
return *y.p; |
| 23 |
} |
| 24 |
extern void abort (void); |
| 25 |
int main() |
| 26 |
{ |
| 27 |
struct X x; |
| 28 |
x.y.p = &i; |
| 29 |
if (foo(&x) != 1) |
| 30 |
abort (); |
| 31 |
return 0; |
| 32 |
} |
| 33 |
|
| 34 |
/* { dg-final { scan-tree-dump "y.* = { i }" "ealias" } } */ |
| 35 |
/* { dg-final { scan-tree-dump "y.*, points-to vars: { D..... }" "ealias" } } */ |