2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
|
2012-10-19 20:44:48 +08:00
|
|
|
// expected-no-diagnostics
|
2009-02-22 11:31:23 +08:00
|
|
|
|
|
|
|
// PR3433
|
|
|
|
double g1;
|
|
|
|
short chk1[__alignof__(g1) == 8 ? 1 : -1];
|
2009-05-26 05:27:19 +08:00
|
|
|
short chk2[__alignof__(double) == 8 ? 1 : -1];
|
|
|
|
|
|
|
|
long long g2;
|
|
|
|
short chk1[__alignof__(g2) == 8 ? 1 : -1];
|
|
|
|
short chk2[__alignof__(long long) == 8 ? 1 : -1];
|
|
|
|
|
2012-03-22 04:20:47 +08:00
|
|
|
unsigned long long g5;
|
|
|
|
short chk1[__alignof__(g5) == 8 ? 1 : -1];
|
|
|
|
short chk2[__alignof__(unsigned long long) == 8 ? 1 : -1];
|
|
|
|
|
2009-05-26 05:27:19 +08:00
|
|
|
_Complex double g3;
|
|
|
|
short chk1[__alignof__(g3) == 8 ? 1 : -1];
|
|
|
|
short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];
|
2010-02-23 12:52:00 +08:00
|
|
|
|
|
|
|
// PR6362
|
2011-03-08 06:57:45 +08:00
|
|
|
struct __attribute__((packed)) {unsigned int a;} g4;
|
2010-02-23 12:52:00 +08:00
|
|
|
short chk1[__alignof__(g4) == 1 ? 1 : -1];
|
|
|
|
short chk2[__alignof__(g4.a) == 1 ? 1 : -1];
|
|
|
|
|
2011-04-27 05:05:39 +08:00
|
|
|
|
|
|
|
// PR5637
|
|
|
|
|
|
|
|
#define ALIGNED(x) __attribute__((aligned(x)))
|
|
|
|
|
|
|
|
typedef ALIGNED(2) struct {
|
|
|
|
char a[3];
|
|
|
|
} T;
|
|
|
|
|
|
|
|
short chk1[sizeof(T) == 3 ? 1 : -1];
|
|
|
|
short chk2[sizeof(T[1]) == 4 ? 1 : -1];
|
|
|
|
short chk3[sizeof(T[2]) == 6 ? 1 : -1];
|
|
|
|
short chk4[sizeof(T[2][1]) == 8 ? 1 : -1];
|
|
|
|
short chk5[sizeof(T[1][2]) == 6 ? 1 : -1];
|
|
|
|
|
|
|
|
typedef struct ALIGNED(2) {
|
|
|
|
char a[3];
|
|
|
|
} T2;
|
|
|
|
|
|
|
|
short chk1[sizeof(T2) == 4 ? 1 : -1];
|
|
|
|
short chk2[sizeof(T2[1]) == 4 ? 1 : -1];
|
|
|
|
short chk3[sizeof(T2[2]) == 8 ? 1 : -1];
|
|
|
|
short chk4[sizeof(T2[2][1]) == 8 ? 1 : -1];
|
|
|
|
short chk5[sizeof(T2[1][2]) == 8 ? 1 : -1];
|