3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

address compiler warnings, and user question #6544

This commit is contained in:
Nikolaj Bjorner 2023-01-19 19:02:43 -08:00
parent 523a3f34b0
commit d11e5c8ca6
16 changed files with 11 additions and 57 deletions

View file

@ -372,7 +372,7 @@ namespace sat {
}
}
CTRACE("sat_drat", num_true == 0 && num_undef == 1, display(tout););
SASSERT(num_true != 0 || num_undef != 1);
VERIFY(num_true != 0 || num_undef != 1);
}
}
}

View file

@ -105,7 +105,7 @@ namespace sat {
if (c.frozen())
num_frozen++;
}
SASSERT(num_frozen == s.m_num_frozen);
VERIFY(num_frozen == s.m_num_frozen);
return check_clauses(s.begin_learned(), s.end_learned());
}

View file

@ -580,7 +580,6 @@ namespace sat {
bool_var v = null_bool_var;
unsigned num_unsat = m_unsat_stack.size();
constraint const& c = m_constraints[m_unsat_stack[m_rand() % num_unsat]];
unsigned reflipped = 0;
bool is_core = m_unsat_stack.size() <= 10;
if (m_rand() % 10000 <= m_noise) {
// take this branch with 98% probability.
@ -684,7 +683,6 @@ namespace sat {
}
if (false && is_core && c.m_k < constraint_value(c)) {
++reflipped;
goto reflip;
}
}

View file

@ -167,6 +167,7 @@ namespace sat {
// end of clause
if (!sat) {
TRACE("sat_model_bug", tout << "failed eliminated: " << mk_lits_pp(static_cast<unsigned>(it - itbegin), itbegin) << "\n";);
(void)itbegin;
ok = false;
}
sat = false;

View file

@ -288,16 +288,13 @@ namespace sat {
clause_vector::iterator it = cs.begin();
clause_vector::iterator it2 = it;
clause_vector::iterator end = cs.end();
unsigned nm = 0;
for (; it != end; ++it) {
clause & c = *(*it);
if (learned && !c.is_learned()) {
s.m_clauses.push_back(&c);
++nm;
}
else if (!learned && c.is_learned()) {
s.m_learned.push_back(&c);
++nm;
}
else {
*it2 = *it;

View file

@ -4284,7 +4284,7 @@ namespace sat {
lbool solver::get_bounded_consequences(literal_vector const& asms, bool_var_vector const& vars, vector<literal_vector>& conseq) {
bool_var_set unfixed_vars;
unsigned num_units = 0, num_iterations = 0;
unsigned num_units = 0;
for (bool_var v : vars) {
unfixed_vars.insert(v);
}
@ -4316,7 +4316,6 @@ namespace sat {
}
while (true) {
++num_iterations;
SASSERT(!inconsistent());
lbool r = bounded_search();
@ -4379,7 +4378,6 @@ namespace sat {
checkpoint();
unsigned num_resolves = 0;
unsigned num_fixed = 0;
unsigned num_assigned = 0;
lbool is_sat = l_true;
for (literal lit : unfixed_lits) {
if (value(lit) != l_undef) {
@ -4390,7 +4388,6 @@ namespace sat {
continue;
}
push();
++num_assigned;
assign_scoped(~lit);
propagate(false);
while (inconsistent()) {

View file

@ -174,10 +174,10 @@ class sat_smt_solver : public solver {
public:
sat_smt_solver(ast_manager& m, params_ref const& p):
solver(m),
m_solver(p, m.limit()),
m_preprocess_state(*this),
m_preprocess(m, p, m_preprocess_state),
m_trail(m_preprocess_state.m_trail),
m_solver(p, m.limit()),
m_dep(m, m_trail),
m_assumptions(m), m_core(m), m_ors(m), m_aux_fmls(m), m_internalized_fmls(m),
m_map(m),

View file

@ -83,9 +83,7 @@ namespace arith {
}
void solver::explain_assumptions(lp::explanation const& e) {
unsigned i = 0;
for (auto const & ev : e) {
++i;
auto idx = ev.ci();
if (UINT_MAX == idx)
continue;

View file

@ -2791,7 +2791,6 @@ namespace pb {
bool solver::subsumes(card& c1, card& c2, literal_vector & comp) {
if (c2.lit() != sat::null_literal) return false;
unsigned c2_exclusive = 0;
unsigned common = 0;
comp.reset();
for (literal l : c2) {
@ -2801,9 +2800,6 @@ namespace pb {
else if (is_visited(~l)) {
comp.push_back(l);
}
else {
++c2_exclusive;
}
}
unsigned c1_exclusive = c1.size() - common - comp.size();
@ -3405,16 +3401,13 @@ namespace pb {
unsigned slack = 0;
unsigned max_level = 0;
unsigned num_max_level = 0;
for (wliteral wl : m_wlits) {
if (value(wl.second) != l_false) ++slack;
unsigned level = lvl(wl.second);
if (level > max_level) {
max_level = level;
num_max_level = 1;
}
else if (max_level == level) {
++num_max_level;
}
}
if (m_overflow)

View file

@ -124,11 +124,9 @@ namespace q {
std::swap(t, s);
}
unsigned sz = evidence.size();
unsigned count = 0;
for (euf::enode* t1 : euf::enode_class(tn)) {
if (!t1->is_cgr())
continue;
++count;
expr* t2 = t1->get_expr();
if ((c = compare_rec(n, binding, s, t2, evidence), c != l_undef)) {
evidence.push_back(euf::enode_pair(t1, tn));

View file

@ -3797,7 +3797,6 @@ namespace q {
}
void rematch(bool use_irrelevant) override {
unsigned lbl = 0;
for (auto * t : m_trees) {
if (t) {
m_interpreter.init(t);
@ -3807,7 +3806,6 @@ namespace q {
m_interpreter.execute_core(t, curr);
}
}
++lbl;
}
}

View file

@ -190,7 +190,7 @@ namespace tseitin {
complement_mark(arg);
if (is_marked(x) && is_complement(y))
return true;
if (is_marked(y) & is_complement(x))
if (is_marked(y) && is_complement(x))
return true;
}