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

but only marginally.

llvm-svn: 52700
This commit is contained in:
Owen Anderson 2008-06-25 01:05:05 +00:00
parent 845eb8ea44
commit ee9c30d435
1 changed files with 1 additions and 1 deletions

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;
}