It seems like to_int assumes that the bitvector gets converted to a string of the form #bxxx, but for bitvectors of size 1 it is actually true or false (at least when using the bitwuzla solver). For example, the following code causes a crash in to_int:
SmtSolver solver = BitwuzlaSolverFactory::create(false);
solver->set_opt("produce-models", "true");
solver->set_opt("incremental", "true");
Sort sort = solver->make_sort(BV, 1);
Term x = solver->make_symbol("x", sort);
solver->check_sat();
uint64_t i = solver->get_value(x)->to_int();
std::cout << i << "\n";
It seems like
to_int
assumes that the bitvector gets converted to a string of the form#bxxx
, but for bitvectors of size 1 it is actuallytrue
orfalse
(at least when using the bitwuzla solver). For example, the following code causes a crash into_int
:I would instead expect
to_int
to return0
or1
.