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