[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Tue Sep 14 19:32:26 PDT 2004
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.105 -> 1.106
---
Log message:
When creating constant arrays check that the initializer vector is the
same size as the one in the array type.
---
Diffs of the changes: (+2 -0)
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.105 llvm/lib/VMCore/Constants.cpp:1.106
--- llvm/lib/VMCore/Constants.cpp:1.105 Thu Sep 9 23:16:59 2004
+++ llvm/lib/VMCore/Constants.cpp Tue Sep 14 21:32:15 2004
@@ -245,6 +245,8 @@
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() ||
More information about the llvm-commits
mailing list