1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 
4 extern void abort (void);
5 
6 struct S
7 {
8   int w, x, y, z;
9 };
10 
11 struct T
12 {
13   int r;
14   struct S s;
15 };
16 
bar(struct S x,struct S * y)17 struct S bar (struct S x, struct S *y)
18 {
19   y->w = 4;
20   return *y;
21 }
22 
23 void
foo(int a,struct T b)24 foo (int a, struct T b)
25 {
26   struct S x;
27   struct S *c = &x;
28   if (a)
29     c = &b.s;
30   b.s.w = 3;
31   /* This call should be marked as clobbering 'x' and 'b'.  */
32   *c = bar (*c, c);
33   if (b.s.w == 3)
34     abort ();
35 }
36 
37 float Y;
38 
bar1(struct S x,struct S y)39 struct S bar1 (struct S x, struct S y)
40 {
41   Y = 4;
42   return x;
43 }
44 
45 void
foo1(int a,struct T b)46 foo1 (int a, struct T b)
47 {
48   struct S x;
49   struct S *c = &x;
50   float z, *k = &z;
51   if (a)
52     c = &b.s;
53   b.s.w = 3;
54   /* This call should NOT be marked as clobbering 'x' and 'b'.  */
55   x = bar1 (*c, *c);
56   if (b.s.w != 3)
57     link_error ();
58 }
59 
main()60 int main ()
61 {
62   struct T b;
63   foo (3, b);
64   foo1 (3, b);
65   return 0;
66 }
67