-
Notifications
You must be signed in to change notification settings - Fork 118
Description
The behavior in ::dump_smt
is not consistent across solvers:
Z3 dumps the smt formula to the file defined in output
. If there is no file defined, it just swallows everything.
esbmc/src/solvers/z3/z3_conv.cpp
Lines 1306 to 1317 in 9a2bd18
void z3_convt::dump_smt() | |
{ | |
const std::string &path = options.get_option("output"); | |
/* the iostream API is just unusable */ | |
if (path == "-") | |
print_smt_formulae(std::cout); | |
else | |
{ | |
std::ofstream out(path); | |
print_smt_formulae(out); | |
} | |
} |
Note that this wasn't always the case; previously it would output to stdout when no output
was defined:
a2ff1a8#diff-0489271635db802271e51ff12caa04e85c9fe16e8a38361d69256b0afbc802dfL1305-L1321
Bitwuzla always prints to stdout
esbmc/src/solvers/bitwuzla/bitwuzla_conv.cpp
Lines 828 to 832 in 9a2bd18
void bitwuzla_convt::dump_smt() | |
{ | |
// Print formulas using binary bit-vector output format | |
bitwuzla_print_formula(bitw, "smt2", messaget::state.out, 2); | |
} |
Smtlib observes output
esbmc/src/solvers/smtlib/smtlib_conv.cpp
Lines 163 to 175 in 9a2bd18
void smtlib_convt::dump_smt() | |
{ | |
auto path = config.options.get_option("output"); | |
if (path != "") | |
{ | |
assert(emit_opt_output); | |
emit_opt_output.emit("%s\n", "(check-sat)"); | |
if (path == "-") | |
log_status("SMT formula written to standard output"); | |
else | |
log_status("SMT formula written to output file {}", path); | |
} | |
} |
while Boolector again just prints to stdout:
esbmc/src/solvers/boolector/boolector_conv.cpp
Lines 790 to 793 in 9a2bd18
void boolector_convt::dump_smt() | |
{ | |
boolector_dump_smt2(btor, messaget::state.out); | |
} |
This is annoying when you're wondering why --z3 --smt-formula-only
doesn't print anything on stdout.
The output
parameter is also overused:
it is used in smt-formula printing, vcc printing, goto2c printing and maybe somewhere else.