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