Skip to content

Commit 77d7af0

Browse files
authored
Merge pull request diffblue#7222 from tautschnig/bugfixes/7164-space
External SAT back-end: handle whitespace at end of line gracefully
2 parents 459dd62 + eb01891 commit 77d7af0

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE gcc-only
2+
main.c
3+
--external-sat-solver ./z3-wrapper.sh --trace
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
--
10+
This test is marked "gcc-only" as resolving ./ won't work with Windows.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# handle output by older Z3 versions where the output was not compatible with
4+
# current SAT solvers
5+
6+
z3 $1 2>&1 | \
7+
perl -n -e '
8+
print "s ".uc($1)."ISFIABLE\n" if(/^((un)?sat)\s*$/);
9+
print "v $_\n" if(/^-?\d+/);
10+
print "$_\n" if(/^[sv]\s+/);' 2>&1

src/solvers/sat/external_sat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ external_satt::resultt external_satt::parse_result(std::string solver_output)
109109

110110
if(line[0] == 'v')
111111
{
112-
auto assignments = split_string(line, ' ');
112+
auto assignments = split_string(line, ' ', false, true);
113113

114114
// remove the first element which should be 'v' identifying
115115
// the line as the satisfying assignments

0 commit comments

Comments
 (0)