From 9fadc38c1b01747bc127c8bbdaa2088ca29f3e59 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Thu, 27 Jun 2024 01:53:00 +0000 Subject: [PATCH] Ensure the TestType object lives for the duration of the test function 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();