Commit dd16f58e authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

enumerate_cycles: fix memory management.

* src/tgbaalgos/cycles.cc (tag_state): Destroy duplicate states, not
new states!
* src/tgbatest/cycles.test: Add a test case that used to segfault.
Reported by Étienne Renault.
parent 4ed4e4d2
......@@ -71,7 +71,7 @@ namespace spot
{
std::pair<tagged_state, bool> p =
tags_.insert(std::make_pair(s, state_info()));
if (p.second)
if (!p.second)
s->destroy();
return p.first;
}
......
......@@ -19,20 +19,12 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# While running some benchmark, Tomáš Babiak found that Spot took too
# much time (i.e. >1h) to translate those six formulae. It turns out
# that the WDBA minimization was performed after the degeneralization
# algorithm, while this is not necessary (WDBA will produce a BA, so
# we may as well skip degeneralization). Translating these formulae
# in the test-suite ensure that they don't take too much time (the
# buildfarm will timeout if it does).
. ./defs
set -e
# GNU systems have seq,
# BSD systems have jot.
# Neither of those are POSIX...
if test "*`(seq 1 1 2>/dev/null)`" = "1"; then
have_seq=true
else
......@@ -89,8 +81,10 @@ echo "s$x,s$w,,;"
run 0 ../ltl2tgba -KC -X johnson-fig1.tgba > out
test `wc -l < out` -eq 10
run 0 ../ltl2tgba -KW '(Ga -> Gb) W c' > out
test `grep 'is weak' out | wc -l` -eq 4
test `grep 'is not weak' out | wc -l` -eq 1
run 0 ../ltl2tgba -l -KW 'F(Fa R (Gb & !a))' > out
test `grep 'is weak' out | wc -l` -eq 7
test `grep 'is not weak' out | wc -l` -eq 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment