Fix bugs in minimize().
* src/tgbaalgos/minimize.cc (init_sets, minimize): Fix memory leaks and a usage of the wrong automaton. * src/tgbatest/wdba.test: Try using -Rm with -R3 or -R3b, and with valgrind. This caught all the bugs fixed above.
This commit is contained in:
parent
72139fd760
commit
7d8a5310e4
3 changed files with 44 additions and 4 deletions
|
|
@ -1,3 +1,12 @@
|
||||||
|
2010-11-25 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||||
|
|
||||||
|
Fix bugs in minimize().
|
||||||
|
|
||||||
|
* src/tgbaalgos/minimize.cc (init_sets, minimize): Fix memory
|
||||||
|
leaks and a usage of the wrong automaton.
|
||||||
|
* src/tgbatest/wdba.test: Try using -Rm with -R3 or -R3b, and with
|
||||||
|
valgrind. This caught all the bugs fixed above.
|
||||||
|
|
||||||
2010-04-13 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
2010-04-13 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||||
|
|
||||||
Fix bugs in minimize(), caught by spotlbtt.test.
|
Fix bugs in minimize(), caught by spotlbtt.test.
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ namespace spot
|
||||||
tovisit.pop();
|
tovisit.pop();
|
||||||
// Is the state final ?
|
// Is the state final ?
|
||||||
if (final.find(src) == final.end())
|
if (final.find(src) == final.end())
|
||||||
// No, add it to the set non_final
|
// No, add it to the set non_final
|
||||||
non_final.insert(src);
|
non_final.insert(src->clone());
|
||||||
tgba_succ_iterator* sit = a->succ_iter(src);
|
tgba_succ_iterator* sit = a->succ_iter(src);
|
||||||
for (sit->first(); !sit->done(); sit->next())
|
for (sit->first(); !sit->done(); sit->next())
|
||||||
{
|
{
|
||||||
|
|
@ -67,6 +67,15 @@ namespace spot
|
||||||
}
|
}
|
||||||
delete sit;
|
delete sit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!seen.empty())
|
||||||
|
{
|
||||||
|
hash_set::iterator i = seen.begin();
|
||||||
|
const state* s = *i;
|
||||||
|
seen.erase(i);
|
||||||
|
delete s;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// From the base automaton and the list of sets, build the minimal
|
// From the base automaton and the list of sets, build the minimal
|
||||||
|
|
@ -154,6 +163,8 @@ namespace spot
|
||||||
free_var.insert(i);
|
free_var.insert(i);
|
||||||
std::map<int, int> used_var;
|
std::map<int, int> used_var;
|
||||||
|
|
||||||
|
hash_set* final_copy;
|
||||||
|
|
||||||
if (!final->empty())
|
if (!final->empty())
|
||||||
{
|
{
|
||||||
unsigned s = final->size();
|
unsigned s = final->size();
|
||||||
|
|
@ -166,7 +177,14 @@ namespace spot
|
||||||
for (hash_set::const_iterator i = final->begin();
|
for (hash_set::const_iterator i = final->begin();
|
||||||
i != final->end(); ++i)
|
i != final->end(); ++i)
|
||||||
state_set_map[*i] = set_num;
|
state_set_map[*i] = set_num;
|
||||||
|
|
||||||
|
final_copy = new hash_set(*final);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final_copy = final;
|
||||||
|
}
|
||||||
|
|
||||||
if (!non_final->empty())
|
if (!non_final->empty())
|
||||||
{
|
{
|
||||||
unsigned s = non_final->size();
|
unsigned s = non_final->size();
|
||||||
|
|
@ -181,8 +199,11 @@ namespace spot
|
||||||
i != non_final->end(); ++i)
|
i != non_final->end(); ++i)
|
||||||
state_set_map[*i] = num;
|
state_set_map[*i] = num;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete non_final;
|
||||||
|
}
|
||||||
|
|
||||||
hash_set* final_copy = new hash_set(*final);
|
|
||||||
// A bdd_states_map is a list of formulae (in a BDD form) associated with a
|
// A bdd_states_map is a list of formulae (in a BDD form) associated with a
|
||||||
// destination set of states.
|
// destination set of states.
|
||||||
typedef std::list<std::pair<bdd, hash_set*> > bdd_states_map;
|
typedef std::list<std::pair<bdd, hash_set*> > bdd_states_map;
|
||||||
|
|
@ -198,7 +219,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
const state* src = *hi;
|
const state* src = *hi;
|
||||||
bdd f = bddfalse;
|
bdd f = bddfalse;
|
||||||
tgba_succ_iterator* si = a->succ_iter(src);
|
tgba_succ_iterator* si = det_a->succ_iter(src);
|
||||||
for (si->first(); !si->done(); si->next())
|
for (si->first(); !si->done(); si->next())
|
||||||
{
|
{
|
||||||
const state* dst = si->current_state();
|
const state* dst = si->current_state();
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,11 @@ EOF
|
||||||
|
|
||||||
success=:
|
success=:
|
||||||
while read f; do
|
while read f; do
|
||||||
|
# Run ltl2tgba through valgrind with some combination of options to
|
||||||
|
# detect any crash
|
||||||
|
run 0 ../ltl2tgba -f -R3 -DS -Rm "!($f)" >/dev/null
|
||||||
|
run 0 ../ltl2tgba -l -R3b -DS -Rm "!($f)" >/dev/null
|
||||||
|
|
||||||
# If the labels of the state have only digits, assume the minimization
|
# If the labels of the state have only digits, assume the minimization
|
||||||
# worked.
|
# worked.
|
||||||
x=`../ltl2tgba -f -Rm "!($f)" |
|
x=`../ltl2tgba -f -Rm "!($f)" |
|
||||||
|
|
@ -102,6 +107,11 @@ done < obligations.txt
|
||||||
echo ====
|
echo ====
|
||||||
|
|
||||||
while read f; do
|
while read f; do
|
||||||
|
# Run ltl2tgba through valgrind with some combination of options to
|
||||||
|
# detect any crash
|
||||||
|
run 0 ../ltl2tgba -f -R3 -DS -Rm "!($f)" >/dev/null
|
||||||
|
run 0 ../ltl2tgba -l -R3b -DS -Rm "!($f)" >/dev/null
|
||||||
|
|
||||||
# If the labels of the state have only digits, assume the minimization
|
# If the labels of the state have only digits, assume the minimization
|
||||||
# worked.
|
# worked.
|
||||||
x=`../ltl2tgba -f -Rm "!($f)" |
|
x=`../ltl2tgba -f -Rm "!($f)" |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue