re PR tree-optimization/57303 (struct miscompiled at -O1 and above)
[gcc.git] / gcc / testsuite / gcc.dg / torture / pr57303.c
1 /* { dg-do run } */
2
3 void abort (void);
4
5 struct S0
6 {
7 int f0;
8 };
9 struct S1
10 {
11 struct S0 f0;
12 };
13
14 struct S1 x = { {0} };
15 struct S1 y = { {1} };
16
17 static void
18 foo (struct S0 p)
19 {
20 struct S0 *l = &y.f0;
21 *l = x.f0;
22 if (p.f0)
23 *l = *l;
24 }
25
26 int
27 main ()
28 {
29 foo(y.f0);
30 if (y.f0.f0 != 0)
31 abort ();
32 return 0;
33 }