dbranch: fix handling of states without successors

Fixes #524, reported by Rüdiger Ehlers.

* spot/twaalgos/dbranch.cc: When merging an edge going to state
without successors simply delete it.
* bin/spot-x.cc: Typo in documentation.
* tests/core/ltlcross.test: Add a test case.
* NEWS: Mention the bug.
This commit is contained in:
Alexandre Duret-Lutz 2023-01-23 11:59:49 +01:00
parent 09bbaa1e41
commit a9c457f93f
4 changed files with 31 additions and 21 deletions

4
NEWS
View file

@ -24,6 +24,10 @@ New in spot 2.11.3.dev (not yet released)
multiple initial states (because Spot supports only one), the HOA multiple initial states (because Spot supports only one), the HOA
parser could break state-based acceptance. (Issue #522.) parser could break state-based acceptance. (Issue #522.)
- delay_branching_here(), a new optimization of Spot 2.11 had an
incorrectly handling of states without successors, causing some
segfaults. (Issue #524.)
New in spot 2.11.3 (2022-12-09) New in spot 2.11.3 (2022-12-09)
Bug fixes: Bug fixes:

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2013-2022 Laboratoire de Recherche et Développement // Copyright (C) 2013-2023 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -53,7 +53,7 @@ implication-based simplifications are attempted. Defaults to 16.") },
{ nullptr, 0, nullptr, 0, "Translation options:", 0 }, { nullptr, 0, nullptr, 0, "Translation options:", 0 },
{ DOC("ltl-split", "Set to 0 to disable the translation of automata \ { DOC("ltl-split", "Set to 0 to disable the translation of automata \
as product or sum of subformulas.") }, as product or sum of subformulas.") },
{ DOC("branch-prop", "Set to 0 to disable branching-postponement \ { DOC("branch-post", "Set to 0 to disable branching-postponement \
(done during translation, may create more states) and delayed-branching \ (done during translation, may create more states) and delayed-branching \
(almost similar, but done after translation to only remove states). \ (almost similar, but done after translation to only remove states). \
Set to 1 to force branching-postponement, and to 2 \ Set to 1 to force branching-postponement, and to 2 \

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2022 Laboratoire de Recherche et Développement // Copyright (C) 2022-2023 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -118,16 +118,18 @@ namespace spot
continue; continue;
} }
unsigned mergedst = it2->second; unsigned mergedst = it2->second;
// we have to merge canddst into mergedst. This is as // we have to merge canddst into mergedst.
// simple as: // This is as simple as:
// 1) connecting their list of transitions // 1) connecting their list of transitions
unsigned& candlast = g.state_storage(canddst).succ_tail;
if (candlast)
{
unsigned& mergedfirst = g.state_storage(mergedst).succ; unsigned& mergedfirst = g.state_storage(mergedst).succ;
unsigned& mergedlast = g.state_storage(mergedst).succ_tail; unsigned& mergedlast = g.state_storage(mergedst).succ_tail;
unsigned& candfirst = g.state_storage(canddst).succ; unsigned& candfirst = g.state_storage(canddst).succ;
unsigned& candlast = g.state_storage(canddst).succ_tail;
if (mergedlast) if (mergedlast)
aut->edge_storage(mergedlast).next_succ = candfirst; aut->edge_storage(mergedlast).next_succ = candfirst;
else // mergedst had now successor else // mergedst had no successor
mergedfirst = candfirst; mergedfirst = candfirst;
mergedlast = candlast; mergedlast = candlast;
// 2) updating the source of the merged transitions // 2) updating the source of the merged transitions
@ -139,6 +141,7 @@ namespace spot
} }
// 3) deleting the edge to canddst. // 3) deleting the edge to canddst.
candfirst = candlast = 0; candfirst = candlast = 0;
}
it.erase(); it.erase();
// 4) updating succ_cand // 4) updating succ_cand
succ_cand[mergedst] += succ_cand[canddst]; succ_cand[mergedst] += succ_cand[canddst];

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2012-2014, 2016, 2019 Laboratoire de Recherche et # Copyright (C) 2012-2014, 2016, 2019, 2023 Laboratoire de Recherche et
# Développement de l'Epita (LRDE). # 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.
@ -65,3 +65,6 @@ ltlcross -D \
# Spot 2.8. We use ltl2tgba twice so ltlcross build cross-products. # Spot 2.8. We use ltl2tgba twice so ltlcross build cross-products.
ltlcross --verbose ltl2tgba ltl2tgba \ ltlcross --verbose ltl2tgba ltl2tgba \
-f '(G(F((a1)&(X(X(b1))))))&(G(F((a2)&(X(X(b2))))))&(G(F((a3)&(X(X(b3))))))' -f '(G(F((a1)&(X(X(b1))))))&(G(F((a2)&(X(X(b2))))))&(G(F((a3)&(X(X(b3))))))'
# Issue #524.
ltlcross ltl2tgba -f '!(X(v3 | G!v5) | ((Xv5 & !(v5 & !X!v3)) U !v5))'