Fixed some bugs.
[llvm/zpu.git] / test / FrontendC / 2010-07-14-ref-off-end.c
blobc7fdd95a7aa0e8a04944c1a7bd3fc266c696cb5b
1 // RUN: %llvmgcc %s -S -m32 -o - | FileCheck %s
2 // Formerly this generated code that did a load past the end of the structure.
3 // That was fixed by 46726, but that patch had bad side effects and was
4 // reverted. This has been fixed another way in the meantime.
5 extern void abort();
6 extern void exit(int);
7 struct T
9 unsigned i:8;
10 unsigned c:24;
12 f(struct T t)
14 struct T s[1];
15 s[0]=t;
16 return(char)s->c;
18 main()
20 // CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0
21 // CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0
22 struct T t;
23 t.i=0xff;
24 t.c=0xffff11;
25 if(f(t)!=0x11)abort();
26 exit(0);