align-x86.c revision ef8225444452a1486bd721f3285301fe84643b00
1// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s 2// expected-no-diagnostics 3 4// PR3433 5double g1; 6short chk1[__alignof__(g1) == 8 ? 1 : -1]; 7short chk2[__alignof__(double) == 8 ? 1 : -1]; 8 9long long g2; 10short chk1[__alignof__(g2) == 8 ? 1 : -1]; 11short chk2[__alignof__(long long) == 8 ? 1 : -1]; 12 13unsigned long long g5; 14short chk1[__alignof__(g5) == 8 ? 1 : -1]; 15short chk2[__alignof__(unsigned long long) == 8 ? 1 : -1]; 16 17_Complex double g3; 18short chk1[__alignof__(g3) == 8 ? 1 : -1]; 19short chk2[__alignof__(_Complex double) == 8 ? 1 : -1]; 20 21// PR6362 22struct __attribute__((packed)) {unsigned int a;} g4; 23short chk1[__alignof__(g4) == 1 ? 1 : -1]; 24short chk2[__alignof__(g4.a) == 1 ? 1 : -1]; 25 26double g6[3]; 27short chk1[__alignof__(g6) == 8 ? 1 : -1]; 28short chk2[__alignof__(double[3]) == 8 ? 1 : -1]; 29 30 31// PR5637 32 33#define ALIGNED(x) __attribute__((aligned(x))) 34 35typedef ALIGNED(2) struct { 36 char a[3]; 37} T; 38 39short chk1[sizeof(T) == 3 ? 1 : -1]; 40short chk2[sizeof(T[1]) == 4 ? 1 : -1]; 41short chk3[sizeof(T[2]) == 6 ? 1 : -1]; 42short chk4[sizeof(T[2][1]) == 8 ? 1 : -1]; 43short chk5[sizeof(T[1][2]) == 6 ? 1 : -1]; 44 45typedef struct ALIGNED(2) { 46 char a[3]; 47} T2; 48 49short chk1[sizeof(T2) == 4 ? 1 : -1]; 50short chk2[sizeof(T2[1]) == 4 ? 1 : -1]; 51short chk3[sizeof(T2[2]) == 8 ? 1 : -1]; 52short chk4[sizeof(T2[2][1]) == 8 ? 1 : -1]; 53short chk5[sizeof(T2[1][2]) == 8 ? 1 : -1]; 54