Fix no-scope internal error on virtual interface method calls (#7759)
This commit is contained in:
parent
394c9bc9b2
commit
c6caa94fe0
|
|
@ -248,9 +248,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
|
||||
|
|
@ -1638,6 +1638,7 @@ class TaskVisitor final : public VNVisitor {
|
|||
// Create cloned statements
|
||||
AstNode* beginp;
|
||||
AstCNew* cnewp = nullptr;
|
||||
// getScope() is safe here: TaskStateVisitor stamped all FTask scopes before this pass.
|
||||
const bool virtualIfaceCall
|
||||
= TaskStateVisitor::isVirtualIfaceMethodCall(nodep)
|
||||
&& TaskStateVisitor::isIfaceFTaskScope(m_statep->getScope(nodep->taskp()));
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
@ -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
|
||||
Loading…
Reference in New Issue