Use push_back rather than operator[], which is incorrect in this cases. Unfortunately, this slow the testcase down a little bit,

but only marginally.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52700 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-06-25 01:05:05 +00:00
parent d41720a2d7
commit e4f6ee590b

View File

@ -1380,7 +1380,7 @@ std::string ConstantArray::getAsString() const {
std::string Result;
Result.reserve(getNumOperands());
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
Result[i] = (char)cast<ConstantInt>(getOperand(i))->getZExtValue();
Result.push_back((char)cast<ConstantInt>(getOperand(i))->getZExtValue());
return Result;
}