]>
Commit | Line | Data |
---|---|---|
87637d21 DN |
1 | /* { dg-do link } */ |
2 | /* { dg-options "-O2" } */ | |
3 | ||
4 | struct S | |
5 | { | |
6 | int w, x, y, z; | |
7 | }; | |
8 | ||
9 | struct T | |
10 | { | |
11 | int r; | |
12 | struct S s; | |
13 | }; | |
14 | ||
8ece1ab3 MP |
15 | void link_error (void); |
16 | int bar (struct S, int); | |
17 | ||
87637d21 DN |
18 | void |
19 | foo (int a, struct T b) | |
20 | { | |
a1d13fa1 DN |
21 | struct S *c = 0; |
22 | ||
87637d21 DN |
23 | if (a) |
24 | c = &b.s; | |
a1d13fa1 | 25 | |
87637d21 | 26 | b.s.w = 3; |
a1d13fa1 DN |
27 | |
28 | /* Since 'c' may be pointing to NULL here, we used to flag it as | |
29 | pointing anywhere, which was forcing the aliaser to mark as | |
30 | call-clobbered every other variable pointed-to by 'c' ('b' in | |
31 | this case). This, in turn, caused the insertion of V_MAY_DEFs | |
32 | for 'b' at this call-site, which prevented constant propagation | |
33 | from 'b.s.w = 3' to 'if (b.s.w != 3)'. */ | |
87637d21 | 34 | bar (*c, a); |
a1d13fa1 | 35 | |
87637d21 DN |
36 | if (b.s.w != 3) |
37 | link_error (); | |
38 | } | |
39 | ||
40 | int main () | |
41 | { | |
42 | struct T b; | |
43 | foo (3, b); | |
44 | return 0; | |
45 | } | |
46 | ||
47 | int X; | |
48 | ||
49 | int bar (struct S x, int i) | |
50 | { | |
51 | X = 3; | |
52 | } |