]> granicus.if.org Git - clang/commitdiff
Report the natural alignment of unsigned long long, not the preferred alignment.
authorChad Rosier <mcrosier@apple.com>
Wed, 21 Mar 2012 20:20:47 +0000 (20:20 +0000)
committerChad Rosier <mcrosier@apple.com>
Wed, 21 Mar 2012 20:20:47 +0000 (20:20 +0000)
rdar://11054144

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153216 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/Sema/align-x86.c

index b7e7850329f0b91b6f89644003c777fc6beefaef..f62418b11aaa9fabc9e9b48cd80c59aa6258a149 100644 (file)
@@ -1165,7 +1165,8 @@ unsigned ASTContext::getPreferredTypeAlign(const Type *T) const {
   if (const ComplexType* CT = T->getAs<ComplexType>())
     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;
index 61bd1d33c9d6e457af92615cfffd1941637bc5f0..c6cd7543c21d4fd9fbfccf212846e4e6c9f89473 100644 (file)
@@ -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];