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