Use push_back rather than operator[], which is incorrect in this cases. Unfortunately...
[oota-llvm.git] / lib / VMCore / Constants.cpp
index 39c0a8c70107f5c551f574db91eee3e6449cef88..b9976a72070a59022701dc29f0d5a91e38cd28aa 100644 (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;
 }