work around potential null dereference warning

* spot/twaalgos/ltl2taa.cc: Here.
* NEWS: Mention the issue.
This commit is contained in:
Alexandre Duret-Lutz 2019-03-17 17:11:24 +01:00
parent bb51499b11
commit c63521d67a
2 changed files with 12 additions and 2 deletions

5
NEWS
View file

@ -14,6 +14,11 @@ New in spot 2.7.1.dev (not yet released)
possible to iterate over a kripke_graph object in a way similar to possible to iterate over a kripke_graph object in a way similar to
twa_graph. twa_graph.
Build:
- Work around a spurious null dereference warning when compiling
with --coverage and g++ 8.3.0-3 from Debian unstable.
New in spot 2.7.1 (2019-02-14) New in spot 2.7.1 (2019-02-14)
Build Build

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009-2010, 2012-2016, 2018 Laboratoire de Recherche // Copyright (C) 2009-2010, 2012-2016, 2018-2019 Laboratoire de
// et Développement de l'Epita (LRDE). // Recherche et Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include <utility> #include <utility>
#include <algorithm> #include <algorithm>
#include <cassert>
#include <spot/tl/unabbrev.hh> #include <spot/tl/unabbrev.hh>
#include <spot/tl/nenoform.hh> #include <spot/tl/nenoform.hh>
#include <spot/tl/contain.hh> #include <spot/tl/contain.hh>
@ -340,6 +341,10 @@ namespace spot
for (unsigned i = 0; i < vs.size(); ++i) for (unsigned i = 0; i < vs.size(); ++i)
pos[i] = vs[i].succ_.size(); pos[i] = vs[i].succ_.size();
// g++ (Debian 8.3.0-3) 8.3.0 in --coverage mode,
// reports a "potential null pointer dereference" on the next
// line without this assert...
assert(pos.size() > 0);
while (pos[0] != 0) while (pos[0] != 0)
{ {
std::vector<formula> u; // Union std::vector<formula> u; // Union