Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20050613-1.c

raw
1 /* PR tree-optimization/22043 */
2
3 extern void abort (void);
4
5 struct A { int i; int j; int k; int l; };
6 struct B { struct A a; int r[1]; };
7 struct C { struct A a; int r[0]; };
8 struct D { struct A a; int r[]; };
9
10 void
11 foo (struct A *x)
12 {
13 if (x->i != 0 || x->j != 5 || x->k != 0 || x->l != 0)
14 abort ();
15 }
16
17 int
18 main ()
19 {
20 struct B b = { .a.j = 5 };
21 struct C c = { .a.j = 5 };
22 struct D d = { .a.j = 5 };
23 foo (&b.a);
24 foo (&c.a);
25 foo (&d.a);
26 return 0;
27 }