Skip to content

External SAT back-end: handle whitespace at end of line gracefully #7222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions regression/cbmc/Failing_Assert1/external-z3.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE gcc-only
main.c
--external-sat-solver ./z3-wrapper.sh --trace
^VERIFICATION FAILED$
^EXIT=10$
^SIGNAL=0$
--
^warning: ignoring
--
This test is marked "gcc-only" as resolving ./ won't work with Windows.
10 changes: 10 additions & 0 deletions regression/cbmc/Failing_Assert1/z3-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# handle output by older Z3 versions where the output was not compatible with
# current SAT solvers

z3 $1 2>&1 | \
perl -n -e '
print "s ".uc($1)."ISFIABLE\n" if(/^((un)?sat)\s*$/);
print "v $_\n" if(/^-?\d+/);
print "$_\n" if(/^[sv]\s+/);' 2>&1
2 changes: 1 addition & 1 deletion src/solvers/sat/external_sat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ external_satt::resultt external_satt::parse_result(std::string solver_output)

if(line[0] == 'v')
{
auto assignments = split_string(line, ' ');
auto assignments = split_string(line, ' ', false, true);

// remove the first element which should be 'v' identifying
// the line as the satisfying assignments
Expand Down