blob: 112394a651b4cb7de2d2b62f370b945b15909b77 [file] [log] [blame]
Rafael Espindolab1ebba92011-01-14 17:01:20 +00001// RUN: %llvmgcc %s -S -O0 -o - | grep {= internal unnamed_addr global} | count 4
Dale Johannesen9ebb4d22009-06-12 18:41:53 +00002// PR 3518
3// Some of the objects were coming out as unintialized (external) before 3518
4// was fixed. Internal names are different between llvm-gcc and clang so they
5// are not tested.
6
7extern void abort (void);
8
9struct A { int i; int j; };
10struct B { struct A *a; struct A *b; };
11struct C { struct B *c; struct A *d; };
12struct C e = { &(struct B) { &(struct A) { 1, 2 }, &(struct A) { 3, 4 } }, &(struct A) { 5, 6 } };
13
14int
15main (void)
16{
17 if (e.c->a->i != 1 || e.c->a->j != 2)
18 abort ();
19 if (e.c->b->i != 3 || e.c->b->j != 4)
20 abort ();
21 if (e.d->i != 5 || e.d->j != 6)
22 abort ();
23 return 0;
24}