[AST] asm goto labels don't have constraints, don't try to copy them.

Found by asan.

llvm-svn: 362062
This commit is contained in:
Benjamin Kramer 2019-05-30 07:21:08 +00:00
parent b19977d5af
commit 851f57effa
1 changed files with 6 additions and 4 deletions

View File

@ -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);