diff options
| author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-09-15 02:32:15 +0000 |
|---|---|---|
| committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-09-15 02:32:15 +0000 |
| commit | 0507ffebb12adf7d1ce98daedc7ba06a3fc70ce8 (patch) | |
| tree | e0d36a09d8aefc063bfc3ffa3a808b6e9dc9bc6e /llvm/lib | |
| parent | 4bf01357e189e31b7c677de38835ce0909c9534d (diff) | |
| download | bcm5719-llvm-0507ffebb12adf7d1ce98daedc7ba06a3fc70ce8.tar.gz bcm5719-llvm-0507ffebb12adf7d1ce98daedc7ba06a3fc70ce8.zip | |
When creating constant arrays check that the initializer vector is the
same size as the one in the array type.
llvm-svn: 16354
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 8148f44b033..a029d8466bf 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/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() || |

