mirror of
https://github.com/Z3Prover/z3
synced 2025-06-15 10:26:16 +00:00
Fix crash reported at http://z3.codeplex.com/workitem/11. Fix array rewriter bug, rewriter was producing sort incorrect expression.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3cc9d57438
commit
2a286541e0
3 changed files with 16 additions and 8 deletions
|
@ -51,6 +51,8 @@ Version 4.3.2
|
||||||
|
|
||||||
- Fixed timers on Linux and FreeBSD.
|
- Fixed timers on Linux and FreeBSD.
|
||||||
|
|
||||||
|
- Fixed crash reported at http://z3.codeplex.com/workitem/11.
|
||||||
|
|
||||||
Version 4.3.1
|
Version 4.3.1
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
@ -113,15 +113,14 @@ func_decl * array_decl_plugin::mk_const(sort * s, unsigned arity, sort * const *
|
||||||
m_manager->raise_exception("invalid const array definition, invalid domain size");
|
m_manager->raise_exception("invalid const array definition, invalid domain size");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
unsigned num_parameters = s->get_num_parameters();
|
if (!is_array_sort(s)) {
|
||||||
|
m_manager->raise_exception("invalid const array definition, parameter is not an array sort");
|
||||||
if (num_parameters == 0) {
|
return 0;
|
||||||
m_manager->raise_exception("parameter mismatch");
|
}
|
||||||
|
if (!m_manager->compatible_sorts(get_array_range(s), domain[0])) {
|
||||||
|
m_manager->raise_exception("invalid const array definition, sort mismatch between array range and argument");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TBD check that range sort corresponds to last parameter.
|
|
||||||
|
|
||||||
parameter param(s);
|
parameter param(s);
|
||||||
func_decl_info info(m_family_id, OP_CONST_ARRAY, 1, ¶m);
|
func_decl_info info(m_family_id, OP_CONST_ARRAY, 1, ¶m);
|
||||||
info.m_private_parameters = true;
|
info.m_private_parameters = true;
|
||||||
|
|
|
@ -292,7 +292,14 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c
|
||||||
}
|
}
|
||||||
|
|
||||||
expr * fv = m().mk_app(f, values.size(), values.c_ptr());
|
expr * fv = m().mk_app(f, values.size(), values.c_ptr());
|
||||||
parameter p(m().get_sort(args[0]));
|
sort * in_s = get_sort(args[0]);
|
||||||
|
ptr_vector<sort> domain;
|
||||||
|
unsigned domain_sz = get_array_arity(in_s);
|
||||||
|
for (unsigned i = 0; i < domain_sz; i++)
|
||||||
|
domain.push_back(get_array_domain(in_s, i));
|
||||||
|
sort_ref out_s(m());
|
||||||
|
out_s = m_util.mk_array_sort(domain_sz, domain.c_ptr(), f->get_range());
|
||||||
|
parameter p(out_s.get());
|
||||||
result = m().mk_app(get_fid(), OP_CONST_ARRAY, 1, &p, 1, &fv);
|
result = m().mk_app(get_fid(), OP_CONST_ARRAY, 1, &p, 1, &fv);
|
||||||
return BR_REWRITE2;
|
return BR_REWRITE2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue