PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / pr19633.c
blob66a542a2192103005702daf9ffc80f965b561474
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 link_error (void);
16 int bar (struct S, int);
18 void
19 foo (int a, struct T b)
21 struct S *c = 0;
23 if (a)
24 c = &b.s;
26 b.s.w = 3;
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)'. */
34 bar (*c, a);
36 if (b.s.w != 3)
37 link_error ();
40 int main ()
42 struct T b;
43 foo (3, b);
44 return 0;
47 int X;
49 int bar (struct S x, int i)
51 X = 3;