diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index fae0e369a9..c67b41f4e2 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -85,7 +85,12 @@ class VISIBILITY_HIDDEN ConstStructBuilder { // Add the field. Elements.push_back(C); NextFieldOffsetInBytes = AlignedNextFieldOffsetInBytes + getSizeInBytes(C); - LLVMStructAlignment = std::max(LLVMStructAlignment, FieldAlignment); + + if (Packed) + assert(LLVMStructAlignment == 1 && "Packed struct not byte-aligned!"); + else + LLVMStructAlignment = std::max(LLVMStructAlignment, FieldAlignment); + return true; } |