Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s |
Eli Friedman | c508203 | 2009-02-22 03:31:23 +0000 | [diff] [blame] | 2 | |
| 3 | // PR3433 |
| 4 | double g1; |
| 5 | short chk1[__alignof__(g1) == 8 ? 1 : -1]; |
Eli Friedman | 1eed602 | 2009-05-25 21:27:19 +0000 | [diff] [blame] | 6 | short chk2[__alignof__(double) == 8 ? 1 : -1]; |
| 7 | |
| 8 | long long g2; |
| 9 | short chk1[__alignof__(g2) == 8 ? 1 : -1]; |
| 10 | short chk2[__alignof__(long long) == 8 ? 1 : -1]; |
| 11 | |
Chad Rosier | cde7a1d | 2012-03-21 20:20:47 +0000 | [diff] [blame] | 12 | unsigned long long g5; |
| 13 | short chk1[__alignof__(g5) == 8 ? 1 : -1]; |
| 14 | short chk2[__alignof__(unsigned long long) == 8 ? 1 : -1]; |
| 15 | |
Eli Friedman | 1eed602 | 2009-05-25 21:27:19 +0000 | [diff] [blame] | 16 | _Complex double g3; |
| 17 | short chk1[__alignof__(g3) == 8 ? 1 : -1]; |
| 18 | short chk2[__alignof__(_Complex double) == 8 ? 1 : -1]; |
Charles Davis | 05f6247 | 2010-02-23 04:52:00 +0000 | [diff] [blame] | 19 | |
| 20 | // PR6362 |
Carl Norum | e224ba7 | 2011-03-07 22:57:45 +0000 | [diff] [blame] | 21 | struct __attribute__((packed)) {unsigned int a;} g4; |
Charles Davis | 05f6247 | 2010-02-23 04:52:00 +0000 | [diff] [blame] | 22 | short chk1[__alignof__(g4) == 1 ? 1 : -1]; |
| 23 | short chk2[__alignof__(g4.a) == 1 ? 1 : -1]; |
| 24 | |
Argyrios Kyrtzidis | cd88b41 | 2011-04-26 21:05:39 +0000 | [diff] [blame] | 25 | |
| 26 | // PR5637 |
| 27 | |
| 28 | #define ALIGNED(x) __attribute__((aligned(x))) |
| 29 | |
| 30 | typedef ALIGNED(2) struct { |
| 31 | char a[3]; |
| 32 | } T; |
| 33 | |
| 34 | short chk1[sizeof(T) == 3 ? 1 : -1]; |
| 35 | short chk2[sizeof(T[1]) == 4 ? 1 : -1]; |
| 36 | short chk3[sizeof(T[2]) == 6 ? 1 : -1]; |
| 37 | short chk4[sizeof(T[2][1]) == 8 ? 1 : -1]; |
| 38 | short chk5[sizeof(T[1][2]) == 6 ? 1 : -1]; |
| 39 | |
| 40 | typedef struct ALIGNED(2) { |
| 41 | char a[3]; |
| 42 | } T2; |
| 43 | |
| 44 | short chk1[sizeof(T2) == 4 ? 1 : -1]; |
| 45 | short chk2[sizeof(T2[1]) == 4 ? 1 : -1]; |
| 46 | short chk3[sizeof(T2[2]) == 8 ? 1 : -1]; |
| 47 | short chk4[sizeof(T2[2][1]) == 8 ? 1 : -1]; |
| 48 | short chk5[sizeof(T2[1][2]) == 8 ? 1 : -1]; |