PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / pr19633-1.c
blob53c3935126d88440db2548d07543e2059d45309e
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 extern void abort (void);
5 extern void link_error (void);
7 struct S
9 int w, x, y, z;
12 struct T
14 int r;
15 struct S s;
18 struct S bar (struct S x, struct S *y)
20 y->w = 4;
21 return *y;
24 void
25 foo (int a, struct T b)
27 struct S x;
28 struct S *c = &x;
29 if (a)
30 c = &b.s;
31 b.s.w = 3;
32 /* This call should be marked as clobbering 'x' and 'b'. */
33 *c = bar (*c, c);
34 if (b.s.w == 3)
35 abort ();
38 float Y;
40 struct S bar1 (struct S x, struct S y)
42 Y = 4;
43 return x;
46 void
47 foo1 (int a, struct T b)
49 struct S x;
50 struct S *c = &x;
51 float z, *k = &z;
52 if (a)
53 c = &b.s;
54 b.s.w = 3;
55 /* This call should NOT be marked as clobbering 'x' and 'b'. */
56 x = bar1 (*c, *c);
57 if (b.s.w != 3)
58 link_error ();
61 int main ()
63 struct T b;
64 foo (3, b);
65 foo1 (3, b);
66 return 0;