Fix side effect internal error (#7519) (#7540) (#7544)

This commit is contained in:
Kamil Danecki 2026-05-07 15:21:04 +02:00 committed by GitHub
parent ce34f1a070
commit 1a367a13fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -268,7 +268,6 @@ class LinkIncVisitor final : public VNVisitor {
void prepost_stmt_sel_visit(AstAssignCompound* const nodep) {
// Special case array[something] += expr, see comments at file top
// UINFOTREE(9, nodep, "", "pp-stmt-sel-in");
iterateChildren(nodep);
AstNodeExpr* const exprp = nodep->rhsp()->unlinkFrBack();
prepost_stmt_sel_visit(nodep, nodep->lhsp(), exprp);
@ -323,7 +322,6 @@ class LinkIncVisitor final : public VNVisitor {
prepost_stmt_visit(nodep, exprp, storeTop, valuep);
}
void prepost_stmt_visit(AstAssignCompound* const nodep) {
iterateChildren(nodep);
AstNodeExpr* const exprp = nodep->rhsp()->unlinkFrBack();
AstNodeExpr* const storeTop = nodep->lhsp()->cloneTreePure(true);
AstNodeExpr* const valuep = nodep->lhsp()->unlinkFrBack();
@ -394,6 +392,7 @@ class LinkIncVisitor final : public VNVisitor {
void visit(AstPreDec* nodep) override { prepost_visit(nodep); }
void visit(AstPostDec* nodep) override { prepost_visit(nodep); }
void visit(AstAssignCompound* nodep) override {
visit(static_cast<AstNodeStmt*>(nodep));
AstSelBit* const selbitp = VN_CAST(nodep->lhsp(), SelBit);
if (!m_insStmtp && selbitp && VN_IS(selbitp->fromp(), NodeVarRef)
&& !selbitp->bitp()->isPure()) {

View File

@ -115,6 +115,12 @@ module t;
`checkd(arr[2], 1);
`checkd(x, 4);
i = 0;
arr[i++] -= 2;
`checkd(arr[0], 5);
arr[++i] += 5;
`checkd(arr[2], 6);
$write("*-* All Finished *-*\n");
$finish;
end