tgba_digraph: Fix handling of initial state.

* src/tgba/tgbagraph.hh: Store the number of the initial state, not a
pointer to it, because if the state vector is reallocated due to some
later calls to new_state(), this pointer will be invalid.
* src/graphtest/tgbagraph.cc, src/graphtest/tgbagraph.test: Test
for this.
This commit is contained in:
Alexandre Duret-Lutz 2014-08-05 19:43:30 +02:00
parent fd5fbda4dd
commit ff83e92db4
3 changed files with 37 additions and 18 deletions

View file

@ -82,6 +82,11 @@ void f1()
std::cerr << tg.num_transitions() << '\n';
assert(tg.num_transitions() == 5);
// Add enough states so that the state vector is reallocated.
for (unsigned i = 0; i < 100; ++i)
tg.new_state();
spot::dotty_reachable(std::cout, &tg);
}
int main()

View file

@ -96,6 +96,18 @@ digraph G {
3 -> 1 [label="1\n{Acc[p2], Acc[p1]}"]
3 -> 2 [label="!p1 | p2\n"]
}
digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="0"]
1 -> 2 [label="p1\n"]
1 -> 3 [label="p2\n{Acc[p2]}"]
2 [label="1"]
2 -> 3 [label="p1 & p2\n{Acc[p1]}"]
3 [label="2"]
3 -> 1 [label="1\n{Acc[p2], Acc[p1]}"]
3 -> 2 [label="!p1 | p2\n"]
}
EOF
diff stdout expected