From 0656ceedd3a61fb46220b5b27915bdc30d7b68bb Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 28 Jun 2024 07:57:19 +1200 Subject: [PATCH] Ensure the TestType object lives for the duration of the test function (#646) Currently the temporary TestType object is destroyed immediately after `depth_ntk` is initialized, leaving a dangling reference. This is caught by ASAN. --- test/views/rank_view.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/views/rank_view.cpp b/test/views/rank_view.cpp index 117916d07..d492396c3 100644 --- a/test/views/rank_view.cpp +++ b/test/views/rank_view.cpp @@ -132,7 +132,8 @@ TEMPLATE_TEST_CASE( "compute ranks for a simple network", "[rank_view]", aig_net TEMPLATE_TEST_CASE( "compute ranks during node construction", "[rank_view]", aig_network, mig_network, xag_network, xmg_network, klut_network, cover_network, buffered_aig_network, buffered_mig_network, crossed_klut_network, buffered_crossed_klut_network ) { - depth_view const depth_ntk{ TestType{} }; + TestType ntk{}; + depth_view const depth_ntk{ ntk }; rank_view rank_ntk{ depth_ntk }; auto const a = rank_ntk.create_pi();