From: Alkis Evlogimenos Date: Wed, 15 Sep 2004 02:32:15 +0000 (+0000) Subject: When creating constant arrays check that the initializer vector is the X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e0de1d64be1a20c7b617d99e11bacbb0325f5bb6;p=oota-llvm.git 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 --- diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 8148f44b033..a029d8466bf 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 &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() ||