aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index d345154f01..7b0e0f5157 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -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.