3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-09-01 15:50:40 +00:00

Fix segfaults in qgen

This commit is contained in:
Arie Gurfinkel 2018-06-27 14:36:59 -04:00
parent 49e9480928
commit 4339722e98
3 changed files with 46 additions and 37 deletions

View file

@ -900,17 +900,22 @@ namespace {
struct collect_indices {
app_ref_vector& m_indices;
array_util a;
collect_indices(app_ref_vector& indices): m_indices(indices), a(indices.get_manager()) {}
collect_indices(app_ref_vector& indices): m_indices(indices),
a(indices.get_manager()) {}
void operator()(expr* n) {}
void operator()(app* n) {
if (a.is_select(n))
for (unsigned i = 1; i < n->get_num_args(); ++i)
if (is_app(n->get_arg(i)))
m_indices.push_back(to_app(n->get_arg(i)));
if (a.is_select(n)) {
// for all but first argument
for (unsigned i = 1; i < n->get_num_args(); ++i) {
expr *arg = n->get_arg(i);
if (is_app(arg))
m_indices.push_back(to_app(arg));
}
}
}
};
void get_select_indices(expr* fml, app_ref_vector &indices, ast_manager& m) {
void get_select_indices(expr* fml, app_ref_vector &indices) {
collect_indices ci(indices);
for_each_expr(ci, fml);
}