From: John McCall Date: Mon, 15 Feb 2010 01:23:36 +0000 (+0000) Subject: When emitting an aggregate into a temporary, make sure we set the alignment X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63efd334081c03a29d351e4aefa00dfaf6966d8a;p=clang When emitting an aggregate into a temporary, make sure we set the alignment on the alloca. The fact that codegen makes this class of bug so wonderfully easy to make is embarrassing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96204 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index ad4fd63cbf..830954fd10 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -95,7 +95,7 @@ RValue CodeGenFunction::EmitAnyExprToTemp(const Expr *E, if (hasAggregateLLVMType(E->getType()) && !E->getType()->isAnyComplexType()) - AggLoc = CreateTempAlloca(ConvertTypeForMem(E->getType()), "agg.tmp"); + AggLoc = CreateMemTemp(E->getType(), "agg.tmp"); return EmitAnyExpr(E, AggLoc, IsAggLocVolatile, /*IgnoreResult=*/false, IsInitializer); }