diff --git a/clang/test/CodeGen/array-init-2.c b/clang/test/CodeGen/array-init-2.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/array-init-2.c @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +typedef enum { + a, + b, + c, + d, + e, + f, + g, + h +} E; + +typedef struct { + E c; + int val; +} Entry; + +static const Entry entries[] = { + {a,}, + {b,}, + {c,}, + {d,}, + {e,}, + {f,}, + {g,}, + {h,} +}; + +const Entry *list[] = { + entries, + entries, + entries +}; + +// CHECK: %struct.Entry = type { [[E:i[0-9]+]], i32 } +// CHECK: @entries = internal constant [8 x %struct.Entry] [%struct.Entry zeroinitializer, %struct.Entry { [[E]] 1, i32 0 }, %struct.Entry { [[E]] 2, i32 0 }, %struct.Entry { [[E]] 3, i32 0 }, %struct.Entry { [[E]] 4, i32 0 }, %struct.Entry { [[E]] 5, i32 0 }, %struct.Entry { [[E]] 6, i32 0 }, %struct.Entry { [[E]] 7, i32 0 }], align 4 +// CHECK: @list = global [3 x %struct.Entry*] [%struct.Entry* getelementptr inbounds ([8 x %struct.Entry], [8 x %struct.Entry]* @entries, i32 0, i32 0), %struct.Entry* getelementptr inbounds ([8 x %struct.Entry], [8 x %struct.Entry]* @entries, i32 0, i32 0), %struct.Entry* getelementptr inbounds ([8 x %struct.Entry], [8 x %struct.Entry]* @entries, i32 0, i32 0)], align 8