summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-20 04:31:01 +0000
committerChris Lattner <sabre@nondot.org>2011-07-20 04:31:01 +0000
commit71bd0c32630971b125556cbdce2404f924133449 (patch)
treed1aa6d26dba6c5636d35aeac1bb158eaad4820da /clang/lib/CodeGen
parentb66d2555954f2c734be6745d305f7f1cfce638f0 (diff)
downloadbcm5719-llvm-71bd0c32630971b125556cbdce2404f924133449.tar.gz
bcm5719-llvm-71bd0c32630971b125556cbdce2404f924133449.zip
fix PR10395 - array decay can produce an interesting type when
decaying an array of incomplete type (which has type [0 x i8]*) to a normal pointer (which has incompletetype*). llvm-svn: 135565
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 37d424a2b35..f64e98ef684 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -1075,7 +1075,10 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
V = Builder.CreateStructGEP(V, 0, "arraydecay");
}
- return V;
+ // Make sure the array decay ends up being the right type. This matters if
+ // the array type was of an incomplete type.
+ return CGF.Builder.CreateBitCast(V,
+ CGF.getTypes().ConvertTypeForMem(CE->getType()));
}
case CK_FunctionToPointerDecay:
return EmitLValue(E).getAddress();
OpenPOWER on IntegriCloud