1 // RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
2 
3 int x __attribute__((aligned(3))); // expected-error {{requested alignment is not a power of 2}}
4 int y __attribute__((aligned(1 << 30))); // expected-error {{requested alignment must be 536870912 bytes or smaller}}
5 
6 // PR26444
7 int y __attribute__((aligned(1 << 29)));
8 int y __attribute__((aligned(1 << 28)));
9 
10 // PR3254
11 short g0[3] __attribute__((aligned));
12 short g0_chk[__alignof__(g0) == 16 ? 1 : -1];
13 
14 // <rdar://problem/6840045>
15 typedef char ueber_aligned_char __attribute__((aligned(8)));
16 
17 struct struct_with_ueber_char {
18   ueber_aligned_char c;
19 };
20 
21 char a = 0;
22 
23 char a0[__alignof__(ueber_aligned_char) == 8? 1 : -1] = { 0 };
24 char a1[__alignof__(struct struct_with_ueber_char) == 8? 1 : -1] = { 0 };
25 char a2[__alignof__(a) == 1? : -1] = { 0 };
26 char a3[sizeof(a) == 1? : -1] = { 0 };
27 
28 typedef long long __attribute__((aligned(1))) underaligned_longlong;
29 char a4[__alignof__(underaligned_longlong) == 1 ?: -1] = {0};
30 
31 typedef long long __attribute__((aligned(1))) underaligned_complex_longlong;
32 char a5[__alignof__(underaligned_complex_longlong) == 1 ?: -1] = {0};
33 
34 // rdar://problem/8335865
35 int b __attribute__((aligned(2)));
36 char b1[__alignof__(b) == 2 ?: -1] = {0};
37 
38 struct C { int member __attribute__((aligned(2))); } c;
39 char c1[__alignof__(c) == 4 ?: -1] = {0};
40 char c2[__alignof__(c.member) == 4 ?: -1] = {0};
41 
42 struct D { int member __attribute__((aligned(2))) __attribute__((packed)); } d;
43 char d1[__alignof__(d) == 2 ?: -1] = {0};
44 char d2[__alignof__(d.member) == 2 ?: -1] = {0};
45 
46 struct E { int member __attribute__((aligned(2))); } __attribute__((packed));
47 struct E e;
48 char e1[__alignof__(e) == 2 ?: -1] = {0};
49 char e2[__alignof__(e.member) == 2 ?: -1] = {0};
50 
51 typedef char overaligned_char __attribute__((aligned(16)));
52 typedef overaligned_char array_with_overaligned_char[11];
53 typedef char array_with_align_attr[11] __attribute__((aligned(16)));
54 
55 char f0[__alignof__(array_with_overaligned_char) == 16 ? 1 : -1] = { 0 };
56 char f1[__alignof__(array_with_align_attr) == 16 ? 1 : -1] = { 0 };
57 array_with_overaligned_char F2;
58 char f2[__alignof__(F2) == 16 ? 1 : -1] = { 0 };
59 array_with_align_attr F3;
60 char f3[__alignof__(F3) == 16 ? 1 : -1] = { 0 };
61