summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-01-30 16:41:04 +0000
committerAnders Carlsson <andersca@mac.com>2009-01-30 16:41:04 +0000
commit221483dd4e6c4241d1ed0f1545bd97285c83a215 (patch)
tree7224a37d939e8a3003e29042e10e61086968e2e3 /clang/lib/CodeGen
parent3b6a4bd891c6aea7da24322d640f237fb7a48918 (diff)
downloadbcm5719-llvm-221483dd4e6c4241d1ed0f1545bd97285c83a215.tar.gz
bcm5719-llvm-221483dd4e6c4241d1ed0f1545bd97285c83a215.zip
Make sure to cast the VLA size of array to the type of size_t. Fixes PR3442.
llvm-svn: 63394
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 1d389b6049c..44eefea71db 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -684,7 +684,10 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) {
// sizeof(type) - make sure to emit the VLA size.
CGF.EmitVLASize(TypeToSize);
}
- return CGF.GetVLASize(VAT);
+
+ llvm::Value *VLASize = CGF.GetVLASize(VAT);
+ return Builder.CreateIntCast(VLASize, ConvertType(E->getType()),
+ false, "conv");
}
}
OpenPOWER on IntegriCloud