[cfe-commits] r154893 - /cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Chad Rosier mcrosier at apple.com
Mon Apr 16 18:14:29 PDT 2012


Author: mcrosier
Date: Mon Apr 16 20:14:29 2012
New Revision: 154893

URL: http://llvm.org/viewvc/llvm-project?rev=154893&view=rev
Log:
Fix case where the alignment is overaligned, per Eli's suggestion.
rdar://11220251

Modified:
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=154893&r1=154892&r2=154893&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Mon Apr 16 20:14:29 2012
@@ -238,7 +238,10 @@
 
   // 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.





More information about the cfe-commits mailing list