blob: c7fdd95a7aa0e8a04944c1a7bd3fc266c696cb5b [file] [log] [blame]
Dale Johannesenbe876e32010-07-14 21:22:35 +00001// 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.
5extern void abort();
6extern void exit(int);
7struct T
8{
9unsigned i:8;
10unsigned c:24;
11};
12f(struct T t)
13{
14struct T s[1];
15s[0]=t;
16return(char)s->c;
17}
18main()
19{
Chris Lattner7dd123d2010-09-02 23:32:55 +000020// CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0
21// CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0
Dale Johannesenbe876e32010-07-14 21:22:35 +000022struct T t;
23t.i=0xff;
24t.c=0xffff11;
25if(f(t)!=0x11)abort();
26exit(0);
27}