From add4ec6e806ce622e1be0e92f66df8b92ab5bb33 Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Fri, 6 Mar 2026 20:46:38 +0100 Subject: [PATCH] Set lifetime to static Signed-off-by: Kamil Danecki --- src/V3Fork.cpp | 3 ++- src/V3LinkParse.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index 2e40faa24..f50210308 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -434,6 +434,7 @@ class DynScopeVisitor final : public VNVisitor { void visit(AstVarRef* nodep) override { ForkDynScopeFrame* const framep = frameOf(nodep->varp()); if (!framep) return; + UINFO(0, "IS AUTO " << nodep->varp()->lifetime()); if (needsDynScope(nodep)) { bool isEvent = false; if (AstBasicDType* const dtypep = VN_CAST(nodep->dtypep()->skipRefp(), BasicDType)) { @@ -448,7 +449,7 @@ class DynScopeVisitor final : public VNVisitor { "Writing to an " << nodep->varp()->verilogKwd() << " variable of a function after a timing control is not allowed"); - } else { + } else if (nodep->varp()->lifetime().isAutomatic()) { nodep->v3warn(E_UNSUPPORTED, "Unsupported: Writing to a captured " << nodep->varp()->verilogKwd() << " variable in a " diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 4e238c75f..f0451a042 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -382,7 +382,12 @@ class LinkParseVisitor final : public VNVisitor { } } } else if (m_ftaskp) { - if (!nodep->lifetime().isAutomatic()) nodep->lifetime(VLifetime::AUTOMATIC_IMPLICIT); + UINFO(0, "TASK LIFE " << m_ftaskp->lifetime()); + if (m_ftaskp->lifetime().isStatic()) { + nodep->lifetime(VLifetime::STATIC_IMPLICIT); + } else { + if (!nodep->lifetime().isAutomatic()) nodep->lifetime(VLifetime::AUTOMATIC_IMPLICIT); + } } else if (nodep->lifetime().isNone()) { // lifetime shouldn't be unknown, set static if none nodep->lifetime(VLifetime::STATIC_IMPLICIT);