Fix No-scope internal error on virtual interface method calls

This commit is contained in:
Yilou Wang 2026-06-03 19:23:53 +02:00
parent 9455dddab4
commit 34aa31beca
3 changed files with 45 additions and 3 deletions

View File

@ -246,9 +246,9 @@ private:
UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked task");
TaskFTaskVertex* const taskVtxp = getFTaskVertex(nodep->taskp());
new TaskEdge{&m_callGraph, m_curVxp, taskVtxp};
if (isVirtualIfaceMethodCall(nodep) && isIfaceFTaskScope(getScope(nodep->taskp()))) {
taskVtxp->needsNonInlineCFunc(true);
}
// Virtual-interface method calls dispatch through a runtime handle and
// must not be inlined.
if (isVirtualIfaceMethodCall(nodep)) taskVtxp->needsNonInlineCFunc(true);
// Do we have to disable inlining the function?
const V3TaskConnects tconnects = V3Task::taskConnects(nodep, nodep->taskp()->stmtsp());
if (!taskVtxp->noInline()) { // Else short-circuit below

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of either the GNU Lesser General Public License Version 3
# or the Perl Artistic License Version 2.0.
# SPDX-FileCopyrightText: 2026 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.compile(verilator_flags2=["--binary"])
test.execute()
test.passes()

View File

@ -0,0 +1,24 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2026 PlanV GmbH
// SPDX-License-Identifier: CC0-1.0
interface iface;
int cnt = 0;
function void bump();
cnt++;
endfunction
endinterface
module t;
iface theIf ();
virtual iface vif;
initial begin
vif = theIf;
vif.bump();
if (theIf.cnt !== 1) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule