r362062 - [AST] asm goto labels don't have constraints, don't try to copy them.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 00:21:08 PDT 2019
Author: d0k
Date: Thu May 30 00:21:08 2019
New Revision: 362062
URL: http://llvm.org/viewvc/llvm-project?rev=362062&view=rev
Log:
[AST] asm goto labels don't have constraints, don't try to copy them.
Found by asan.
Modified:
cfe/trunk/lib/AST/Stmt.cpp
Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=362062&r1=362061&r2=362062&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Thu May 30 00:21:08 2019
@@ -483,9 +483,10 @@ void GCCAsmStmt::setOutputsAndInputsAndC
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
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);
More information about the cfe-commits
mailing list