fix spurious g++-14 warning

* spot/twaalgos/mealy_machine.cc (mm_sat_prob_t<true>::get_sol): Here.
This commit is contained in:
Alexandre Duret-Lutz 2024-09-02 17:28:28 +02:00
parent 1a36ea6ce4
commit 941475fbdb

View file

@ -2604,9 +2604,14 @@ namespace
return {};
case PICOSAT_SATISFIABLE:
{
std::vector<int>
res(1 + (unsigned) picosat_variables(lm.psat_), -1);
SPOT_ASSUME(res.data()); // g++ 11 believes data might be nullptr
unsigned nvar = 1 + (unsigned) picosat_variables(lm.psat_);
// Asssuming res.data() non-null was enough to prevent g++
// 11 from issuing a spurious "potential null pointer
// dereference" on the res[0] assignment. Since g++14 we
// also need to assume nvar>0.
SPOT_ASSUME(nvar > 0);
std::vector<int> res(nvar, -1);
SPOT_ASSUME(res.data());
res[0] = 0; // Convention
for (int lit : lm.all_lits)
res[lit] = picosat_deref(lm.psat_, lit);