Eric Christopher | 3883e66 | 2011-07-26 22:17:02 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple i686-apple-darwin -emit-llvm -o - | FileCheck %s |
| 2 | // Every printf has 'i32 0' for the GEP of the string; no point counting those. |
| 3 | typedef unsigned int Foo __attribute__((aligned(32))); |
| 4 | typedef union{Foo:0;}a; |
| 5 | typedef union{int x; Foo:0;}b; |
| 6 | extern int printf(const char*, ...); |
| 7 | int main() { |
| 8 | // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 0 |
| 9 | printf("%ld\n", sizeof(a)); |
| 10 | // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 1 |
| 11 | printf("%ld\n", __alignof__(a)); |
| 12 | // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 4 |
| 13 | printf("%ld\n", sizeof(b)); |
| 14 | // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 4 |
| 15 | printf("%ld\n", __alignof__(b)); |
| 16 | } |