From 7d684004210005c9f03be6dcb25be9c1b521ba75 Mon Sep 17 00:00:00 2001 From: Matthew Ballance Date: Sat, 20 Dec 2025 21:02:57 +0000 Subject: [PATCH] test: add regression for debug broken-link assert --- test_regress/t/t_min_uaf_repro_real.py | 13 +++++++ test_regress/t/t_min_uaf_repro_real.sv | 54 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 test_regress/t/t_min_uaf_repro_real.py create mode 100644 test_regress/t/t_min_uaf_repro_real.sv diff --git a/test_regress/t/t_min_uaf_repro_real.py b/test_regress/t/t_min_uaf_repro_real.py new file mode 100644 index 000000000..8b0163495 --- /dev/null +++ b/test_regress/t/t_min_uaf_repro_real.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Regression test for min_uaf_repro_real + +import vltest_bootstrap + +test.scenarios('simulator') +test.top_filename = "t/t_min_uaf_repro_real.sv" + +test.compile(verilator_flags2=['--binary', '--timing', '--debug']) + +test.execute() + +test.passes() diff --git a/test_regress/t/t_min_uaf_repro_real.sv b/test_regress/t/t_min_uaf_repro_real.sv new file mode 100644 index 000000000..48ed92e7c --- /dev/null +++ b/test_regress/t/t_min_uaf_repro_real.sv @@ -0,0 +1,54 @@ +// DESCRIPTION: Regression test for scope/var lifetime issue (debug build) +// +// This is derived from testcase/min_uaf_repro_real.sv (from issue reproducer). +// + +package p; + typedef chandle PyObject; + + class uvm_object; + endclass + + class py_object; + function new(PyObject o); + endfunction + endclass + + class pyhdl_uvm_object_rgy; + static pyhdl_uvm_object_rgy m_inst; + + static function pyhdl_uvm_object_rgy inst(); + if (m_inst == null) m_inst = new; + return m_inst; + endfunction + + function PyObject wrap(uvm_object obj); + if (obj == null) return null; + return null; + endfunction + endclass + + class comp_proxy; + virtual function PyObject get_config_object(string name, bit clone = 0); + uvm_object obj; + py_object py_obj; + bit has = 0; + + if (has && obj != null) begin + py_obj = new(pyhdl_uvm_object_rgy::inst().wrap(obj)); + end + + return null; + endfunction + endclass +endpackage + +module t; + import p::*; + + initial begin + comp_proxy cp = new; + void'(cp.get_config_object("x")); + $finish; + end +endmodule