aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-09-15 02:32:15 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-09-15 02:32:15 +0000
commite0de1d64be1a20c7b617d99e11bacbb0325f5bb6 (patch)
tree1b2e423dd25045059f06ca2378ab3c53dc190a04 /lib
parenta2700194aed0b9d11a0ebf70e260f7ed70c86213 (diff)
downloadexternal_llvm-e0de1d64be1a20c7b617d99e11bacbb0325f5bb6.zip
external_llvm-e0de1d64be1a20c7b617d99e11bacbb0325f5bb6.tar.gz
external_llvm-e0de1d64be1a20c7b617d99e11bacbb0325f5bb6.tar.bz2
When creating constant arrays check that the initializer vector is the
same size as the one in the array type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Constants.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 8148f44..a029d84 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -245,6 +245,8 @@ ConstantFP::ConstantFP(const Type *Ty, double V) : Constant(Ty) {
ConstantArray::ConstantArray(const ArrayType *T,
const std::vector<Constant*> &V) : Constant(T) {
+ assert(V.size() == T->getNumElements() &&
+ "Invalid initializer vector for constant array");
Operands.reserve(V.size());
for (unsigned i = 0, e = V.size(); i != e; ++i) {
assert((V[i]->getType() == T->getElementType() ||