summaryrefslogtreecommitdiff
path: root/test/Sema/align-x86.c
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2010-02-23 04:52:00 +0000
committerCharles Davis <cdavis@mines.edu>2010-02-23 04:52:00 +0000
commit05f62474dd2b0f1cb69adbe0787f2868788aa949 (patch)
tree871666d8384a86f6a30119c4ac87616fb2b9971e /test/Sema/align-x86.c
parent464c8f176b4590aa3cab643865ab985423063dd5 (diff)
downloadclang-05f62474dd2b0f1cb69adbe0787f2868788aa949.tar.gz
When a reference to a field of a struct/union/class is passed to the
__alignof__ operator, make sure to take into account the packed alignment of the struct/union/class itself. Matches GCC's behavior and fixes PR6362. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96884 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/align-x86.c')
-rw-r--r--test/Sema/align-x86.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Sema/align-x86.c b/test/Sema/align-x86.c
index f67adecbf5..c9a63989ec 100644
--- a/test/Sema/align-x86.c
+++ b/test/Sema/align-x86.c
@@ -12,3 +12,9 @@ short chk2[__alignof__(long long) == 8 ? 1 : -1];
_Complex double g3;
short chk1[__alignof__(g3) == 8 ? 1 : -1];
short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];
+
+// PR6362
+struct __attribute__((packed)) {unsigned int a} g4;
+short chk1[__alignof__(g4) == 1 ? 1 : -1];
+short chk2[__alignof__(g4.a) == 1 ? 1 : -1];
+