diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-20 04:31:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-20 04:31:01 +0000 |
commit | 410b12e55395216a02a848a791a38b0f153eba87 (patch) | |
tree | 77d6fe06fbb5e403e7d393be3287c9a40e09a58a /lib/CodeGen/CGExprScalar.cpp | |
parent | 14ad03b6f4350f062256757efc4149a7df94bdf9 (diff) |
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*).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 37d424a2b3..f64e98ef68 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/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(); |