OSDN Git Service

* gcc.dg/torture/pr26565.c: Expect warning on packed field for
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / gnu89-init-2.c
1 /* Test whether __compound_literal.* objects are not emitted unless
2    they are actually needed.  */
3 /* Origin: Jakub Jelinek <jakub@redhat.com> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=gnu89 -O2" } */
6 /* { dg-final { scan-assembler-not "__compound_literal" } } */
7
8 struct A { int i; int j; int k[4]; };
9 struct B { };
10 struct C { int i; };
11 struct D { int i; struct C j; };
12
13 struct A a = (struct A) { .j = 6, .k[2] = 12 };
14 struct B b = (struct B) { };
15 int c[] = (int []) { [2] = 6, 7, 8 };
16 int d[] = (int [3]) { 1 };
17 int e[2] = (int []) { 1, 2 };
18 int f[2] = (int [2]) { 1 };
19 struct C g[3] = { [2] = (struct C) { 13 }, [1] = (const struct C) { 12 } };
20 struct D h = { .j = (struct C) { 15 }, .i = 14 };
21 struct D i[2] = { [1].j = (const struct C) { 17 },
22                   [0] = { 0, (struct C) { 16 } } };
23 static const int *j = 1 ? (const int *) 0 : & (const int) { 26 };
24 int k = (int) sizeof ((int [6]) { 1, 2, 3, 4, 5, 6 }) + 4;
25 int l = (int) sizeof ((struct C) { 16 });