Fix lifetime of expression coverage variable (#7834)

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
Ryszard Rozak 2026-06-24 15:59:32 +02:00 committed by GitHub
parent 9462c2a910
commit def1e2ccbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -824,6 +824,7 @@ class CoverageVisitor final : public VNVisitor {
if (pair.second) {
varp = new AstVar{fl, VVarType::MODULETEMP, m_exprTempNames.get(frefp),
dtypep};
varp->lifetime(VLifetime::AUTOMATIC_EXPLICIT);
pair.first->second = varp;
if (m_ftaskp) {
varp->funcLocal(true);

View File

@ -13,6 +13,9 @@ module t;
if (!x) begin
cnt++;
end
if (!$onehot(x)) begin
cnt++;
end
end
join_none
endtask
@ -20,7 +23,7 @@ module t;
initial begin
myTask();
#1;
if (cnt != 1) $stop;
if (cnt != 2) $stop;
$write("*-* All Finished *-*\n");
$finish;