Compare commits

..

2 commits

Author SHA1 Message Date
cd3281621b merge 2025-10-17 17:40:11 +02:00
c63412ab94 translate_aa: fix sere copy
When adapting the code to handle transition-based acceptance, a bug was
introduced so that only accepting edges were copied to the result
automaton.

The self-loop labeled as false edge-case is here as prevention, I am not
sure it happens in practice.

* spot/twaalgos/translate_aa.cc: Here.
2025-10-17 17:40:11 +02:00

View file

@ -124,19 +124,16 @@ namespace spot
bool edge_is_acc = ((trans_based && e.acc) bool edge_is_acc = ((trans_based && e.acc)
|| (!trans_based && sere_aut->state_is_accepting(e.dst))); || (!trans_based && sere_aut->state_is_accepting(e.dst)));
if (edge_is_acc) unsigned new_edge;
{
// point to accepting sink instead of original dst if asked // point to accepting sink instead of original dst if asked
if (use_accepting_sink) if(use_accepting_sink && edge_is_acc)
aut_->new_edge(new_st, accepting_sink_, e.cond); new_edge = aut_->new_edge(new_st, accepting_sink_, e.cond);
else else
{ new_edge = aut_->new_edge(new_st, register_state(e.dst), e.cond);
unsigned new_e = aut_->new_edge(new_st, register_state(e.dst), e.cond);
// remember if old edges were accepting // remember if old edges were accepting
if (acc_edges != nullptr) if (acc_edges != nullptr && edge_is_acc)
acc_edges->push_back(new_e); acc_edges->push_back(new_edge);
}
}
} }
} }
@ -340,6 +337,9 @@ namespace spot
for (unsigned i : acc_edges) for (unsigned i : acc_edges)
{ {
auto& e1 = aut_->edge_storage(i); auto& e1 = aut_->edge_storage(i);
// self loop used to mark accepting state, skip it!
if (e1.cond == bddfalse)
continue;
for (const auto& e2 : aut_->out(rhs_init)) for (const auto& e2 : aut_->out(rhs_init))
aut_->new_edge(e1.src, e2.dst, e1.cond & e2.cond); aut_->new_edge(e1.src, e2.dst, e1.cond & e2.cond);
} }