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