| 1 |
/* We used to mis-compile this testcase as we did not know that |
| 2 |
&a+offsetof(b,a) was the same as &a.b */ |
| 3 |
|
| 4 |
void abort (void); |
| 5 |
|
| 6 |
struct A |
| 7 |
{ |
| 8 |
int t; |
| 9 |
int i; |
| 10 |
}; |
| 11 |
|
| 12 |
void |
| 13 |
bar (float *p) |
| 14 |
{ |
| 15 |
*p = 5.2; |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
foo(struct A *locp, int i, int str) |
| 20 |
{ |
| 21 |
float f, g, *p; |
| 22 |
int T355; |
| 23 |
int *T356; |
| 24 |
/* Currently, the alias analyzer has limited support for handling |
| 25 |
aliases of structure fields when no other variables are aliased. |
| 26 |
Introduce additional aliases to confuse it. */ |
| 27 |
p = i ? &g : &f; |
| 28 |
bar (p); |
| 29 |
if (*p > 0.0) |
| 30 |
str = 1; |
| 31 |
|
| 32 |
T355 = locp->i; |
| 33 |
T356 = &locp->i; |
| 34 |
*T356 = str; |
| 35 |
T355 = locp->i; |
| 36 |
|
| 37 |
return T355; |
| 38 |
} |
| 39 |
|
| 40 |
int |
| 41 |
main (void) |
| 42 |
{ |
| 43 |
struct A loc; |
| 44 |
int str; |
| 45 |
|
| 46 |
loc.i = 2; |
| 47 |
str = foo (&loc, 10, 3); |
| 48 |
if (str!=1) |
| 49 |
abort (); |
| 50 |
return 0; |
| 51 |
} |
| 52 |
|