blob: e6f024770855adbb89ee9a7f35571916d3c9b191 [file] [log] [blame]
Eric Christopher85e51562011-07-26 22:17:02 +00001// 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.
3typedef unsigned int Foo __attribute__((aligned(32)));
4typedef union{Foo:0;}a;
5typedef union{int x; Foo:0;}b;
6extern int printf(const char*, ...);
7int main() {
David Blaikiebdf40a62015-03-13 18:21:46 +00008 // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 0
Eric Christopher85e51562011-07-26 22:17:02 +00009 printf("%ld\n", sizeof(a));
David Blaikiebdf40a62015-03-13 18:21:46 +000010 // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 1
Eric Christopher85e51562011-07-26 22:17:02 +000011 printf("%ld\n", __alignof__(a));
David Blaikiebdf40a62015-03-13 18:21:46 +000012 // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 4
Eric Christopher85e51562011-07-26 22:17:02 +000013 printf("%ld\n", sizeof(b));
David Blaikiebdf40a62015-03-13 18:21:46 +000014 // CHECK: getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 4
Eric Christopher85e51562011-07-26 22:17:02 +000015 printf("%ld\n", __alignof__(b));
16}