[ELF] Reorder SectionBase/InputSectionBase members
[llvm-project.git] / clang / test / CodeGen / globalinit.c
blob960b4cd6f0d4931d0ec22ae310cd2d9811b051c5
1 // RUN: %clang_cc1 -emit-llvm %s -o %t
3 int A[10] = { 1,2,3,4,5 };
6 extern int x[];
7 void foo(void) { x[0] = 1; }
8 int x[10];
9 void bar(void) { x[0] = 1; }
12 extern int y[];
13 void *g = y;
15 int latin_ptr2len (char *p);
16 int (*mb_ptr2len) (char *p) = latin_ptr2len;
19 char string[8] = "string"; // extend init
20 char string2[4] = "string"; // truncate init
22 char *test(int c) {
23 static char buf[10];
24 static char *bufptr = buf;
26 return c ? buf : bufptr;
30 _Bool booltest = 0;
31 void booltest2(void) {
32 static _Bool booltest3 = 4;
35 // Scalars in braces.
36 static int a = { 1 };
38 // References to enums.
39 enum {
40 EnumA, EnumB
43 int c[] = { EnumA, EnumB };
45 // Binary operators
46 int d[] = { EnumA | EnumB };
48 // PR1968
49 static int array[];
50 static int array[4];