xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/2009-02-13-zerosize-union-field.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple i686-apple-darwin -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc // Every printf has 'i32 0' for the GEP of the string; no point counting those.
3*f4a2713aSLionel Sambuc typedef unsigned int Foo __attribute__((aligned(32)));
4*f4a2713aSLionel Sambuc typedef union{Foo:0;}a;
5*f4a2713aSLionel Sambuc typedef union{int x; Foo:0;}b;
6*f4a2713aSLionel Sambuc extern int printf(const char*, ...);
main()7*f4a2713aSLionel Sambuc int main() {
8*f4a2713aSLionel Sambuc   // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 0
9*f4a2713aSLionel Sambuc   printf("%ld\n", sizeof(a));
10*f4a2713aSLionel Sambuc   // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 1
11*f4a2713aSLionel Sambuc   printf("%ld\n", __alignof__(a));
12*f4a2713aSLionel Sambuc   // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 4
13*f4a2713aSLionel Sambuc   printf("%ld\n", sizeof(b));
14*f4a2713aSLionel Sambuc   // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 4
15*f4a2713aSLionel Sambuc   printf("%ld\n", __alignof__(b));
16*f4a2713aSLionel Sambuc }
17