From: Chad Rosier Date: Wed, 21 Mar 2012 20:20:47 +0000 (+0000) Subject: Report the natural alignment of unsigned long long, not the preferred alignment. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cde7a1dc68af2eb063a039b5a31c3b7dd92b1aa9;p=clang Report the natural alignment of unsigned long long, not the preferred alignment. rdar://11054144 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153216 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index b7e7850329..f62418b11a 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1165,7 +1165,8 @@ unsigned ASTContext::getPreferredTypeAlign(const Type *T) const { if (const ComplexType* CT = T->getAs()) T = CT->getElementType().getTypePtr(); if (T->isSpecificBuiltinType(BuiltinType::Double) || - T->isSpecificBuiltinType(BuiltinType::LongLong)) + T->isSpecificBuiltinType(BuiltinType::LongLong) || + T->isSpecificBuiltinType(BuiltinType::ULongLong)) return std::max(ABIAlign, (unsigned)getTypeSize(T)); return ABIAlign; diff --git a/test/Sema/align-x86.c b/test/Sema/align-x86.c index 61bd1d33c9..c6cd7543c2 100644 --- a/test/Sema/align-x86.c +++ b/test/Sema/align-x86.c @@ -9,6 +9,10 @@ long long g2; short chk1[__alignof__(g2) == 8 ? 1 : -1]; short chk2[__alignof__(long long) == 8 ? 1 : -1]; +unsigned long long g5; +short chk1[__alignof__(g5) == 8 ? 1 : -1]; +short chk2[__alignof__(unsigned long long) == 8 ? 1 : -1]; + _Complex double g3; short chk1[__alignof__(g3) == 8 ? 1 : -1]; short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];