From 10bc253dd855801d71765dcb0956060092c64e79 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 17 May 2022 15:25:17 +0200 Subject: [PATCH] work around spurious gcc 12 "potentially null dereference" The issue seems to be inside std::vector's copy constructor, but it highlighted places in Spot were we could avoid this copy. * spot/twaalgos/ltl2taa.cc: Avoid some copies of std::vector. --- spot/twaalgos/ltl2taa.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spot/twaalgos/ltl2taa.cc b/spot/twaalgos/ltl2taa.cc index 9c10777a9..eaba49e92 100644 --- a/spot/twaalgos/ltl2taa.cc +++ b/spot/twaalgos/ltl2taa.cc @@ -61,7 +61,8 @@ namespace spot { std::vector empty; res_->create_transition(init_, empty); - succ_state ss = { empty, f, empty }; + succ_state ss; + ss.condition = f; succ_.emplace_back(ss); return; } @@ -76,7 +77,8 @@ namespace spot std::vector empty; taa_tgba::transition* t = res_->create_transition(init_, empty); res_->add_condition(t, f); - succ_state ss = { empty, f, empty }; + succ_state ss; + ss.condition = f; succ_.emplace_back(ss); return; } @@ -90,7 +92,7 @@ namespace spot return; dst.emplace_back(v.init_); res_->create_transition(init_, dst); - succ_state ss = { dst, formula::tt(), a }; + succ_state ss = { std::move(dst), formula::tt(), std::move(a) }; succ_.emplace_back(ss); return; } @@ -206,7 +208,7 @@ namespace spot } t = res_->create_transition(init_, u); res_->add_condition(t, f); - succ_state ss = { u, f, a }; + succ_state ss = { std::move(u), f, std::move(a) }; succ_.emplace_back(ss); }