mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 18:31:49 +00:00
Merge pull request #2338 from levnach/fix
limit the size of bit vectors
This commit is contained in:
commit
4209eeaee7
|
@ -17,12 +17,13 @@ Notes:
|
|||
|
||||
--*/
|
||||
#include "tactic/arith/bv2int_rewriter.h"
|
||||
#include "tactic/tactic_exception.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_util.h"
|
||||
|
||||
void bv2int_rewriter_ctx::update_params(params_ref const& p) {
|
||||
m_max_size = p.get_uint("max_bv_size", UINT_MAX);
|
||||
m_max_size = p.get_uint("max_bv_size", m_max_size);
|
||||
}
|
||||
|
||||
struct lt_rational {
|
||||
|
@ -617,6 +618,9 @@ expr* bv2int_rewriter::mk_extend(unsigned sz, expr* b, bool is_signed) {
|
|||
if (sz == 0) {
|
||||
return b;
|
||||
}
|
||||
if (sz > m_ctx.get_max_num_bits()) {
|
||||
throw tactic_exception(TACTIC_MAX_MEMORY_MSG);
|
||||
}
|
||||
rational r;
|
||||
unsigned bv_sz;
|
||||
if (is_signed) {
|
||||
|
|
|
@ -33,8 +33,10 @@ class bv2int_rewriter_ctx {
|
|||
expr_ref_vector m_trail;
|
||||
|
||||
public:
|
||||
bv2int_rewriter_ctx(ast_manager& m, params_ref const& p) :
|
||||
m_max_size(UINT_MAX), m_side_conditions(m), m_trail(m) { update_params(p); }
|
||||
bv2int_rewriter_ctx(ast_manager& m, params_ref const& p, unsigned max_size) :
|
||||
m_max_size(max_size), m_side_conditions(m), m_trail(m) {
|
||||
update_params(p);
|
||||
}
|
||||
|
||||
void reset() { m_side_conditions.reset(); m_trail.reset(); m_power2.reset(); }
|
||||
void add_side_condition(expr* e) { m_side_conditions.push_back(e); }
|
||||
|
|
|
@ -69,7 +69,7 @@ class nla2bv_tactic : public tactic {
|
|||
m_arith(m),
|
||||
m_bv(m),
|
||||
m_bv2real(m, rational(p.get_uint("nla2bv_root",2)), rational(p.get_uint("nla2bv_divisor",2)), p.get_uint("nla2bv_max_bv_size", UINT_MAX)),
|
||||
m_bv2int_ctx(m, p),
|
||||
m_bv2int_ctx(m, p, p.get_uint("nla2bv_max_bv_size", UINT_MAX)),
|
||||
m_bounds(m),
|
||||
m_subst(m),
|
||||
m_vars(m),
|
||||
|
@ -80,6 +80,9 @@ class nla2bv_tactic : public tactic {
|
|||
}
|
||||
|
||||
~imp() {}
|
||||
|
||||
void updt_params(params_ref const& p) {
|
||||
}
|
||||
|
||||
|
||||
void operator()(goal & g, model_converter_ref & mc) {
|
||||
|
@ -440,7 +443,7 @@ public:
|
|||
}
|
||||
|
||||
void updt_params(params_ref const & p) override {
|
||||
m_params = p;
|
||||
m_params.append(p);
|
||||
}
|
||||
|
||||
void collect_param_descrs(param_descrs & r) override {
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
m_solver(s),
|
||||
m_bv_fns(m),
|
||||
m_int_fns(m),
|
||||
m_rewriter_ctx(m, p),
|
||||
m_rewriter_ctx(m, p, p.get_uint("max_bv_size", UINT_MAX)),
|
||||
m_rewriter(m, m_rewriter_ctx)
|
||||
{
|
||||
solver::updt_params(p);
|
||||
|
|
|
@ -87,7 +87,7 @@ static tactic * mk_qfnia_sat_solver(ast_manager & m, params_ref const & p) {
|
|||
|
||||
return and_then(using_params(mk_simplify_tactic(m), simp_p),
|
||||
mk_nla2bv_tactic(m, nia2sat_p),
|
||||
mk_qfnia_bv_solver(m, p),
|
||||
skip_if_failed(mk_qfnia_bv_solver(m, p)),
|
||||
mk_fail_if_undecided_tactic());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue