diff options
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index e9a2c58..0a4d403 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -483,9 +483,10 @@ void GCCAsmStmt::setOutputsAndInputsAndClobbers(const ASTContext &C, this->Exprs = new (C) Stmt*[NumExprs]; std::copy(Exprs, Exprs + NumExprs, this->Exprs); + unsigned NumConstraints = NumOutputs + NumInputs; C.Deallocate(this->Constraints); - this->Constraints = new (C) StringLiteral*[NumExprs]; - std::copy(Constraints, Constraints + NumExprs, this->Constraints); + this->Constraints = new (C) StringLiteral*[NumConstraints]; + std::copy(Constraints, Constraints + NumConstraints, this->Constraints); C.Deallocate(this->Clobbers); this->Clobbers = new (C) StringLiteral*[NumClobbers]; @@ -756,8 +757,9 @@ GCCAsmStmt::GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, Exprs = new (C) Stmt*[NumExprs]; std::copy(exprs, exprs + NumExprs, Exprs); - Constraints = new (C) StringLiteral*[NumExprs]; - std::copy(constraints, constraints + NumExprs, Constraints); + unsigned NumConstraints = NumOutputs + NumInputs; + Constraints = new (C) StringLiteral*[NumConstraints]; + std::copy(constraints, constraints + NumConstraints, Constraints); Clobbers = new (C) StringLiteral*[NumClobbers]; std::copy(clobbers, clobbers + NumClobbers, Clobbers); |