diff --git a/src/verilog.y b/src/verilog.y index 440e8eadc..230207a61 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -1790,7 +1790,8 @@ net_declaration: // IEEE: net_declaration - excluding implict { $$ = $2; if (GRAMMARP->m_netStrengthp) { VL_DO_CLEAR(delete GRAMMARP->m_netStrengthp, GRAMMARP->m_netStrengthp = nullptr); - }} + } + GRAMMARP->setNetDelay(nullptr); } ; net_declarationFront: // IEEE: beginning of net_declaration @@ -2971,21 +2972,17 @@ netSig: // IEEE: net_decl_assignment - one element from netId sigAttrListE { $$ = VARDONEA($1, *$1, nullptr, $2); } | netId sigAttrListE '=' expr - { AstDelay* const delayp = GRAMMARP->m_netDelayp ? GRAMMARP->m_netDelayp->cloneTree(false) : nullptr; + { $$ = VARDONEA($1, *$1, nullptr, $2); + AstDelay* const delayp = $$->delayp() ? $$->delayp()->unlinkFrBack() : nullptr; AstAssignW* const assignp = new AstAssignW{$3, new AstParseRef{$1, VParseRefExp::PX_TEXT, *$1}, $4, delayp}; - GRAMMARP->setNetDelay(nullptr); - $$ = VARDONEA($1, *$1, nullptr, $2); - if (delayp) GRAMMARP->setNetDelay(delayp->cloneTree(false)); if (GRAMMARP->m_netStrengthp) assignp->strengthSpecp(GRAMMARP->m_netStrengthp->cloneTree(false)); AstNode::addNext($$, assignp); } | netId variable_dimensionList sigAttrListE { $$ = VARDONEA($1, *$1, $2, $3); } | netId variable_dimensionList sigAttrListE '=' expr - { AstDelay* const delayp = GRAMMARP->m_netDelayp ? GRAMMARP->m_netDelayp->cloneTree(false) : nullptr; + { $$ = VARDONEA($1, *$1, $2, $3); + AstDelay* const delayp = $$->delayp() ? $$->delayp()->unlinkFrBack() : nullptr; AstAssignW* const assignp = new AstAssignW{$4, new AstParseRef{$1, VParseRefExp::PX_TEXT, *$1}, $5, delayp}; - GRAMMARP->setNetDelay(nullptr); - $$ = VARDONEA($1, *$1, $2, $3); - if (delayp) GRAMMARP->setNetDelay(delayp->cloneTree(false)); if (GRAMMARP->m_netStrengthp) assignp->strengthSpecp(GRAMMARP->m_netStrengthp->cloneTree(false)); AstNode::addNext($$, assignp); } ; diff --git a/test_regress/t/t_lint_functimectl_bad.v b/test_regress/t/t_lint_functimectl_bad.v index 4f14958ab..b099cd58f 100644 --- a/test_regress/t/t_lint_functimectl_bad.v +++ b/test_regress/t/t_lint_functimectl_bad.v @@ -19,4 +19,10 @@ module t; // TODO ## // TODO expect endfunction + + // No warning here + wire [31:0] #5 __test_wire = 32'd0; + function void f; + int x; + endfunction endmodule