xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/2010-07-14-ref-off-end.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -triple i386-apple-darwin -o - | FileCheck %s
2*f4a2713aSLionel Sambuc extern void abort();
3*f4a2713aSLionel Sambuc extern void exit(int);
4*f4a2713aSLionel Sambuc struct T
5*f4a2713aSLionel Sambuc {
6*f4a2713aSLionel Sambuc unsigned i:8;
7*f4a2713aSLionel Sambuc unsigned c:24;
8*f4a2713aSLionel Sambuc };
f(struct T t)9*f4a2713aSLionel Sambuc f(struct T t)
10*f4a2713aSLionel Sambuc {
11*f4a2713aSLionel Sambuc struct T s[1];
12*f4a2713aSLionel Sambuc s[0]=t;
13*f4a2713aSLionel Sambuc return(char)s->c;
14*f4a2713aSLionel Sambuc }
main()15*f4a2713aSLionel Sambuc main()
16*f4a2713aSLionel Sambuc {
17*f4a2713aSLionel Sambuc // CHECK:  getelementptr inbounds [1 x %struct.T]* %s, i32 0, i32 0
18*f4a2713aSLionel Sambuc // CHECK:  getelementptr inbounds [1 x %struct.T]* %s, i32 0, i32 0
19*f4a2713aSLionel Sambuc struct T t;
20*f4a2713aSLionel Sambuc t.i=0xff;
21*f4a2713aSLionel Sambuc t.c=0xffff11;
22*f4a2713aSLionel Sambuc if(f(t)!=0x11)abort();
23*f4a2713aSLionel Sambuc exit(0);
24*f4a2713aSLionel Sambuc }
25