Dale Johannesen | be876e3 | 2010-07-14 21:22:35 +0000 | [diff] [blame^] | 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 |
| 8 | { |
| 9 | unsigned i:8; |
| 10 | unsigned c:24; |
| 11 | }; |
| 12 | f(struct T t) |
| 13 | { |
| 14 | struct T s[1]; |
| 15 | s[0]=t; |
| 16 | return(char)s->c; |
| 17 | } |
| 18 | main() |
| 19 | { |
| 20 | // CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0 ; <i32*> [#uses=2] |
| 21 | // CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0 ; <i32*> [#uses=2] |
| 22 | struct T t; |
| 23 | t.i=0xff; |
| 24 | t.c=0xffff11; |
| 25 | if(f(t)!=0x11)abort(); |
| 26 | exit(0); |
| 27 | } |