Eric Christopher | 85e5156 | 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() { |
David Blaikie | bdf40a6 | 2015-03-13 18:21:46 +0000 | [diff] [blame] | 8 | // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 0 |
Eric Christopher | 85e5156 | 2011-07-26 22:17:02 +0000 | [diff] [blame] | 9 | printf("%ld\n", sizeof(a)); |
David Blaikie | bdf40a6 | 2015-03-13 18:21:46 +0000 | [diff] [blame] | 10 | // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 1 |
Eric Christopher | 85e5156 | 2011-07-26 22:17:02 +0000 | [diff] [blame] | 11 | printf("%ld\n", __alignof__(a)); |
David Blaikie | bdf40a6 | 2015-03-13 18:21:46 +0000 | [diff] [blame] | 12 | // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 4 |
Eric Christopher | 85e5156 | 2011-07-26 22:17:02 +0000 | [diff] [blame] | 13 | printf("%ld\n", sizeof(b)); |
David Blaikie | bdf40a6 | 2015-03-13 18:21:46 +0000 | [diff] [blame] | 14 | // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 4 |
Eric Christopher | 85e5156 | 2011-07-26 22:17:02 +0000 | [diff] [blame] | 15 | printf("%ld\n", __alignof__(b)); |
| 16 | } |