OSDN Git Service

* tree-loop-linear.c (try_interchange_loops): Compare memory access
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr19633.c
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
15 void
16 foo (int a, struct T b)
17 {
18   struct S *c = 0;
19
20   if (a)
21     c = &b.s;
22
23   b.s.w = 3;
24
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);
32
33   if (b.s.w != 3)
34     link_error ();
35 }
36
37 int main ()
38 {
39   struct T b;
40   foo (3, b);
41   return 0;
42 }
43
44 int X;
45
46 int bar (struct S x, int i)
47 {
48   X = 3;
49 }