align-x86.c revision cde7a1dc68af2eb063a039b5a31c3b7dd92b1aa9
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
12unsigned long long g5;
13short chk1[__alignof__(g5) == 8 ? 1 : -1];
14short chk2[__alignof__(unsigned long long) == 8 ? 1 : -1];
15
16_Complex double g3;
17short chk1[__alignof__(g3) == 8 ? 1 : -1];
18short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];
19
20// PR6362
21struct __attribute__((packed)) {unsigned int a;} g4;
22short chk1[__alignof__(g4) == 1 ? 1 : -1];
23short chk2[__alignof__(g4.a) == 1 ? 1 : -1];
24
25
26// PR5637
27
28#define ALIGNED(x) __attribute__((aligned(x)))
29
30typedef ALIGNED(2) struct {
31  char a[3];
32} T;
33
34short chk1[sizeof(T)       == 3 ? 1 : -1];
35short chk2[sizeof(T[1])    == 4 ? 1 : -1];
36short chk3[sizeof(T[2])    == 6 ? 1 : -1];
37short chk4[sizeof(T[2][1]) == 8 ? 1 : -1];
38short chk5[sizeof(T[1][2]) == 6 ? 1 : -1];
39
40typedef struct ALIGNED(2) {
41  char a[3];
42} T2;
43
44short chk1[sizeof(T2)       == 4 ? 1 : -1];
45short chk2[sizeof(T2[1])    == 4 ? 1 : -1];
46short chk3[sizeof(T2[2])    == 8 ? 1 : -1];
47short chk4[sizeof(T2[2][1]) == 8 ? 1 : -1];
48short chk5[sizeof(T2[1][2]) == 8 ? 1 : -1];
49