Fix $finish inside fork blocks (#6555)

Signed-off-by: Bartłomiej Chmiel <[email protected]>
This commit is contained in:
Bartłomiej Chmiel
2025-10-20 10:16:05 -04:00
committed by GitHub
parent 61c64e4a3b
commit 9bd30baba4
8 changed files with 72 additions and 1 deletions
+4 -1
View File
@@ -441,7 +441,10 @@ class LinkJumpVisitor final : public VNVisitor {
void visit(AstFinish* nodep) override {
if (nodep->user1SetOnce()) return; // Process once
iterateChildren(nodep);
if (m_loopp) {
if (m_inFork) {
nodep->replaceWith(new AstFinishFork{nodep->fileline()});
VL_DO_DANGLING(nodep->deleteTree(), nodep);
} else if (m_loopp) {
// Jump to the end of the loop (post-finish)
AstJumpBlock* const blockp = getJumpBlock(m_loopp, false);
nodep->addNextHere(new AstJumpGo{nodep->fileline(), blockp});