]> granicus.if.org Git - clang/commitdiff
Fix case where the alignment is overaligned, per Eli's suggestion.
authorChad Rosier <mcrosier@apple.com>
Tue, 17 Apr 2012 01:14:29 +0000 (01:14 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 17 Apr 2012 01:14:29 +0000 (01:14 +0000)
rdar://11220251

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

lib/CodeGen/CGExprAgg.cpp

index d345154f01311b0f4d569e2205a9842a6e1d3a59..7b0e0f5157cf7a1c0dac09f3d1e7524b5a596846 100644 (file)
@@ -238,7 +238,10 @@ void AggExprEmitter::EmitMoveFromReturnSlot(const Expr *E, RValue Src) {
 
   // Otherwise, do a final copy, 
   assert(Dest.getAddr() != Src.getAggregateAddr());
-  EmitFinalDestCopy(E, Src, /*Ignore*/ true, Dest.getAlignment().getQuantity());
+  std::pair<CharUnits, CharUnits> TypeInfo = 
+    CGF.getContext().getTypeInfoInChars(E->getType());
+  CharUnits Alignment = std::min(TypeInfo.second, Dest.getAlignment());
+  EmitFinalDestCopy(E, Src, /*Ignore*/ true, Alignment.getQuantity());
 }
 
 /// EmitFinalDestCopy - Perform the final copy to DestPtr, if desired.