* gcc.dg/const-elim-1.c: Remove xfail for xtensa-*-*.
[official-gcc.git] / gcc / testsuite / gcc.dg / pr19633.c
blobfda0df6c5faacedc7c8a839793b5b3f7fd532655
1 /* { dg-do link } */
2 /* { dg-options "-O2" } */
4 struct S
6 int w, x, y, z;
7 };
9 struct T
11 int r;
12 struct S s;
15 void
16 foo (int a, struct T b)
18 struct S *c = 0;
20 if (a)
21 c = &b.s;
23 b.s.w = 3;
25 /* Since 'c' may be pointing to NULL here, we used to flag it as
26 pointing anywhere, which was forcing the aliaser to mark as
27 call-clobbered every other variable pointed-to by 'c' ('b' in
28 this case). This, in turn, caused the insertion of V_MAY_DEFs
29 for 'b' at this call-site, which prevented constant propagation
30 from 'b.s.w = 3' to 'if (b.s.w != 3)'. */
31 bar (*c, a);
33 if (b.s.w != 3)
34 link_error ();
37 int main ()
39 struct T b;
40 foo (3, b);
41 return 0;
44 int X;
46 int bar (struct S x, int i)
48 X = 3;