[ImportVerilog] Fix use after free (#7368)

This commit is contained in:
fzi-hielscher 2024-07-22 22:23:08 +02:00 committed by GitHub
parent 53a7802608
commit 31145f72bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View File

@ -116,10 +116,9 @@ struct RvalueExprVisitor {
if (auto refOp = lhs.getDefiningOp<moore::StructExtractRefOp>()) {
auto input = refOp.getInput();
if (isa<moore::SVModuleOp>(input.getDefiningOp()->getParentOp())) {
refOp.getInputMutable();
refOp->erase();
builder.create<moore::StructInjectOp>(loc, input.getType(), input,
refOp.getFieldNameAttr(), rhs);
refOp->erase();
return rhs;
}
}

View File

@ -424,10 +424,9 @@ struct ModuleVisitor : public BaseVisitor {
if (auto refOp = lhs.getDefiningOp<moore::StructExtractRefOp>()) {
auto input = refOp.getInput();
if (isa<moore::SVModuleOp>(input.getDefiningOp()->getParentOp())) {
refOp.getInputMutable();
refOp->erase();
builder.create<moore::StructInjectOp>(loc, input.getType(), input,
refOp.getFieldNameAttr(), rhs);
refOp->erase();
return success();
}
}