Fix segfault in fork synchronization (#5906).

This commit is contained in:
Wilson Snyder
2025-04-04 08:15:39 -04:00
parent 73d52c00bb
commit 6ba06498db
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -723,8 +723,8 @@ class TimingControlVisitor final : public VNVisitor {
void makeForkJoin(AstFork* const forkp) {
// Create a fork sync var
FileLine* const flp = forkp->fileline();
// If we're in a function, insert the sync var directly before the fork
AstNode* const insertBeforep = m_classp ? forkp : nullptr;
// Insert the sync var directly before the fork
AstNode* const insertBeforep = forkp;
addCLocalScope(flp, insertBeforep);
AstVarScope* forkVscp
= createTemp(flp, forkp->name() + "__sync", getCreateForkSyncDTypep(), insertBeforep);