1010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
2010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
3010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)int x __attribute__((aligned(3))); // expected-error {{requested alignment is not a power of 2}}
4010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)int y __attribute__((aligned(1 << 29))); // expected-error {{requested alignment must be 268435456 bytes or smaller}}
5010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
6010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)// PR3254
7010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)short g0[3] __attribute__((aligned));
8010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)short g0_chk[__alignof__(g0) == 16 ? 1 : -1];
9010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
10010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)// <rdar://problem/6840045>
11010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)typedef char ueber_aligned_char __attribute__((aligned(8)));
12010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
13010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)struct struct_with_ueber_char {
14010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  ueber_aligned_char c;
15010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)};
16010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
17010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)char a = 0;
18010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
19char a0[__alignof__(ueber_aligned_char) == 8? 1 : -1] = { 0 };
20char a1[__alignof__(struct struct_with_ueber_char) == 8? 1 : -1] = { 0 };
21char a2[__alignof__(a) == 1? : -1] = { 0 };
22char a3[sizeof(a) == 1? : -1] = { 0 };
23
24typedef long long __attribute__((aligned(1))) underaligned_longlong;
25char a4[__alignof__(underaligned_longlong) == 1 ?: -1] = {0};
26
27typedef long long __attribute__((aligned(1))) underaligned_complex_longlong;
28char a5[__alignof__(underaligned_complex_longlong) == 1 ?: -1] = {0};
29
30// rdar://problem/8335865
31int b __attribute__((aligned(2)));
32char b1[__alignof__(b) == 2 ?: -1] = {0};
33
34struct C { int member __attribute__((aligned(2))); } c;
35char c1[__alignof__(c) == 4 ?: -1] = {0};
36char c2[__alignof__(c.member) == 4 ?: -1] = {0};
37
38struct D { int member __attribute__((aligned(2))) __attribute__((packed)); } d;
39char d1[__alignof__(d) == 2 ?: -1] = {0};
40char d2[__alignof__(d.member) == 2 ?: -1] = {0};
41
42struct E { int member __attribute__((aligned(2))); } __attribute__((packed));
43struct E e;
44char e1[__alignof__(e) == 2 ?: -1] = {0};
45char e2[__alignof__(e.member) == 2 ?: -1] = {0};
46
47typedef char overaligned_char __attribute__((aligned(16)));
48typedef overaligned_char array_with_overaligned_char[11];
49typedef char array_with_align_attr[11] __attribute__((aligned(16)));
50
51char f0[__alignof__(array_with_overaligned_char) == 16 ? 1 : -1] = { 0 };
52char f1[__alignof__(array_with_align_attr) == 16 ? 1 : -1] = { 0 };
53array_with_overaligned_char F2;
54char f2[__alignof__(F2) == 16 ? 1 : -1] = { 0 };
55array_with_align_attr F3;
56char f3[__alignof__(F3) == 16 ? 1 : -1] = { 0 };
57