Expose most of the Constant creation functions to ocaml.
[oota-llvm.git] / test / FrontendC / pr3518.c
1 // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep {= internal global} | count 4
2 // 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
7 extern void abort (void);
8
9 struct A { int i; int j; };
10 struct B { struct A *a; struct A *b; };
11 struct C { struct B *c; struct A *d; };
12 struct C e = { &(struct B) { &(struct A) { 1, 2 }, &(struct A) { 3, 4 } }, &(struct A) { 5, 6 } };
13
14 int
15 main (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 }