3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 20:18:18 +00:00

fix #2643 - fuzzers are here to get you @lorisdanton

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-10-12 18:19:13 -07:00
parent cc26d49060
commit a921b4ff4a
2 changed files with 10 additions and 5 deletions

View file

@ -251,7 +251,7 @@ eautomaton* re2automaton::operator()(expr* e) {
if (r) { if (r) {
r->compress(); r->compress();
bool_rewriter br(m); bool_rewriter br(m);
TRACE("seq", display_expr1 disp(m); r->display(tout, disp);); TRACE("seq", display_expr1 disp(m); r->display(tout << mk_pp(e, m) << " -->\n", disp););
} }
return r; return r;
} }
@ -348,7 +348,9 @@ eautomaton* re2automaton::re2aut(expr* e) {
return a.detach(); return a.detach();
} }
else if (u.re.is_intersection(e, e1, e2) && m_sa && (a = re2aut(e1)) && (b = re2aut(e2))) { else if (u.re.is_intersection(e, e1, e2) && m_sa && (a = re2aut(e1)) && (b = re2aut(e2))) {
return m_sa->mk_product(*a, *b); eautomaton* r = m_sa->mk_product(*a, *b);
TRACE("seq", display_expr1 disp(m); a->display(tout << "a:", disp); b->display(tout << "b:", disp); r->display(tout << "intersection:", disp););
return r;
} }
else { else {
TRACE("seq", tout << "not handled " << mk_pp(e, m) << "\n";); TRACE("seq", tout << "not handled " << mk_pp(e, m) << "\n";);

View file

@ -381,11 +381,14 @@ typename symbolic_automata<T, M>::automaton_t* symbolic_automata<T, M>::mk_produ
unsigned_vector final; unsigned_vector final;
unsigned_vector a_init, b_init; unsigned_vector a_init, b_init;
a.get_epsilon_closure(a.init(), a_init); a.get_epsilon_closure(a.init(), a_init);
bool a_init_is_final = false, b_init_is_final = false;
for (unsigned ia : a_init) { for (unsigned ia : a_init) {
if (a.is_final_state(ia)) { if (a.is_final_state(ia)) {
a_init_is_final = true;
b.get_epsilon_closure(b.init(), b_init); b.get_epsilon_closure(b.init(), b_init);
for (unsigned ib : b_init) { for (unsigned ib : b_init) {
if (b.is_final_state(ib)) { if (b.is_final_state(ib)) {
b_init_is_final = true;
final.push_back(0); final.push_back(0);
break; break;
} }
@ -438,8 +441,8 @@ typename symbolic_automata<T, M>::automaton_t* symbolic_automata<T, M>::mk_produ
} }
svector<bool> back_reachable(n, false); svector<bool> back_reachable(n, false);
for (unsigned i = 0; i < final.size(); ++i) { for (unsigned f : final) {
back_reachable[final[i]] = true; back_reachable[f] = true;
} }
unsigned_vector stack(final); unsigned_vector stack(final);
@ -464,7 +467,7 @@ typename symbolic_automata<T, M>::automaton_t* symbolic_automata<T, M>::mk_produ
} }
} }
if (mvs1.empty()) { if (mvs1.empty()) {
if (a.is_final_state(a.init()) && b.is_final_state(b.init())) { if (a_init_is_final && b_init_is_final) {
// special case: automaton has no moves, but the initial state is final on both sides // special case: automaton has no moves, but the initial state is final on both sides
// this results in the automaton which accepts the empty sequence and nothing else // this results in the automaton which accepts the empty sequence and nothing else
final.clear(); final.clear();