Skip to content

Commit

Permalink
fix #6488
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Dec 12, 2022
1 parent 039de6a commit a3e6885
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
24 changes: 16 additions & 8 deletions src/ast/simplifiers/elim_unconstrained.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void elim_unconstrained::eliminate() {
m_trail.push_back(r);
SASSERT(r);
gc(e);
init_children(e, r);
freeze_rec(r);

m_root.setx(r->get_id(), e->get_id(), UINT_MAX);
get_node(e).m_term = r;
Expand Down Expand Up @@ -180,9 +180,8 @@ void elim_unconstrained::init_terms(expr_ref_vector const& terms) {
}
}

void elim_unconstrained::init_children(expr* e, expr* r) {
void elim_unconstrained::freeze_rec(expr* r) {
expr_ref_vector children(m);
SASSERT(e != r);
if (is_quantifier(r))
children.push_back(to_quantifier(r)->get_expr());
else if (is_app(r))
Expand All @@ -191,11 +190,20 @@ void elim_unconstrained::init_children(expr* e, expr* r) {
return;
if (children.empty())
return;
init_terms(children);
for (expr* arg : children) {
get_node(arg).m_parents.push_back(e);
inc_ref(arg);
}
for (expr* t : subterms::all(children))
freeze(t);
}

void elim_unconstrained::freeze(expr* t) {
if (!is_uninterp_const(t))
return;
if (m_nodes.size() <= t->get_id())
return;
node& n = get_node(t);
if (!n.m_term)
return;
n.m_refcount = UINT_MAX / 2;
m_heap.increased(root(t));
}

void elim_unconstrained::gc(expr* t) {
Expand Down
3 changes: 2 additions & 1 deletion src/ast/simplifiers/elim_unconstrained.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ class elim_unconstrained : public dependent_expr_simplifier {
unsigned get_refcount(expr* t) const { return get_node(t).m_refcount; }
void inc_ref(expr* t) { ++get_node(t).m_refcount; if (is_uninterp_const(t)) m_heap.increased(root(t)); }
void dec_ref(expr* t) { --get_node(t).m_refcount; if (is_uninterp_const(t)) m_heap.decreased(root(t)); }
void freeze(expr* t);
void freeze_rec(expr* r);
void gc(expr* t);
void init_children(expr* e, expr* r);
expr* get_parent(unsigned n) const;
void init_terms(expr_ref_vector const& terms);
void init_nodes();
Expand Down

1 comment on commit a3e6885

@nunoplopes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is crashing everywhere now:

#0  in elim_unconstrained::freeze(expr*) () from /lib/libz3.so
#1  in elim_unconstrained::freeze_rec(expr*) () from /lib/libz3.so
#2  in elim_unconstrained::eliminate() () from /lib/libz3.so
#3  in elim_unconstrained::reduce() () from /lib/libz3.so

Please sign in to comment.