| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-fre1" } */ |
| 3 |
|
| 4 |
/* This testcase tests nonoverlapping_component_refs_since_match_p in presence |
| 5 |
of non-trivial mem-refs. */ |
| 6 |
struct a {int a,b;}; |
| 7 |
struct b {struct a a[10];}; |
| 8 |
struct c {int c; struct b b;} c, *cptr; |
| 9 |
|
| 10 |
void |
| 11 |
set_a(struct a *a, int p) |
| 12 |
{ |
| 13 |
a->a=p; |
| 14 |
} |
| 15 |
void |
| 16 |
set_b(struct a *a, int p) |
| 17 |
{ |
| 18 |
a->b=p; |
| 19 |
} |
| 20 |
int |
| 21 |
get_a(struct a *a) |
| 22 |
{ |
| 23 |
return a->a; |
| 24 |
} |
| 25 |
|
| 26 |
int |
| 27 |
test(int i, int j) |
| 28 |
{ |
| 29 |
struct b *bptr = &c.b; |
| 30 |
set_a (&bptr->a[i], 123); |
| 31 |
set_b (&bptr->a[j], 124); |
| 32 |
return get_a (&bptr->a[i]); |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
test2(int i, int j) |
| 37 |
{ |
| 38 |
struct b *bptr = &cptr->b; |
| 39 |
set_a (&bptr->a[i], 125); |
| 40 |
set_b (&bptr->a[j], 126); |
| 41 |
return get_a (&bptr->a[i]); |
| 42 |
} |
| 43 |
/* { dg-final { scan-tree-dump-times "return 123" 1 "fre1"} } */ |
| 44 |
/* { dg-final { scan-tree-dump-times "return 125" 1 "fre1"} } */ |