Skip to content

Exception when processing SAT assignment with cryptominisat #7164

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

Closed
zhassan-aws opened this issue Sep 28, 2022 · 1 comment · Fixed by #7222
Closed

Exception when processing SAT assignment with cryptominisat #7164

zhassan-aws opened this issue Sep 28, 2022 · 1 comment · Fixed by #7222
Labels
aws Bugs or features of importance to AWS CBMC users Kani Bugs or features of importance to Kani Rust Verifier pending merge

Comments

@zhassan-aws
Copy link
Collaborator

I'm trying to use https://github.com/msoos/cryptominisat as an external SAT solver. It seems to cause an issue if the test has a counterexample, e.g.

$ cat fail.c 
#include "assert.h"

int main() {
  int x;
  int y = x;
  assert(y != x);

  return 0;
}
$ which cryptominisat5
/home/ubuntu/git/cryptominisat/build/cryptominisat5
$ cbmc fail.c --external-sat-solver cryptominisat5
CBMC version 5.66.0 (cbmc-5.66.0) 64-bit x86_64 linux
Parsing fail.c
Converting
Type-checking fail
Generating GOTO Program
Adding CPROVER library (x86_64)
Removal of function pointers and virtual functions
Generic Property Instrumentation
Running with 8 object bits, 56 offset bits (default)
Starting Bounded Model Checking
Runtime Symex: 0.000673871s
size of program expression: 39 steps
simple slicing removed 5 assignments
Generated 1 VCC(s), 1 remaining after simplification
Runtime Postprocess Equation: 9.28e-06s
Passing problem to propositional reduction
converting SSA
Runtime Convert SSA: 7.9941e-05s
Running propositional reduction
Post-processing
Runtime Post-process: 1.646e-05s
Solving with External SAT solver
Writing temporary CNF
Invoking SAT solver
Solver returned code: 10
result:SATISFIABLE
SAT assignment  caused an exception while processing
Runtime Solver: 0.00365672s
Runtime decision procedure: 0.00378501s

** Results:
fail.c function main
[main.assertion.1] line 6 assertion y != x: ERROR

** 0 of 1 failed (1 iterations)
VERIFICATION ERROR

If I change the assert to

assert(y == x)

verification succeeds:

$ cbmc fail.c --external-sat-solver cryptominisat5
CBMC version 5.66.0 (cbmc-5.66.0) 64-bit x86_64 linux
Parsing fail.c
Converting
Type-checking fail
Generating GOTO Program
Adding CPROVER library (x86_64)
Removal of function pointers and virtual functions
Generic Property Instrumentation
Running with 8 object bits, 56 offset bits (default)
Starting Bounded Model Checking
Runtime Symex: 0.000568689s
size of program expression: 39 steps
simple slicing removed 5 assignments
Generated 1 VCC(s), 1 remaining after simplification
Runtime Postprocess Equation: 9.23e-06s
Passing problem to propositional reduction
converting SSA
Runtime Convert SSA: 8.4671e-05s
Running propositional reduction
Post-processing
Runtime Post-process: 2.2421e-05s
Solving with External SAT solver
Writing temporary CNF
Invoking SAT solver
Solver returned code: 20
result:UNSATISFIABLE
Runtime Solver: 0.003168s
Runtime decision procedure: 0.00330383s

** Results:
fail.c function main
[main.assertion.1] line 6 assertion y == x: SUCCESS

** 0 of 1 failed (1 iterations)
VERIFICATION SUCCESSFUL

Does cryptominisat not produce the correct output that CBMC needs in case of a satisfiable instance?

CBMC version: 5.66.0
Operating system: Ubuntu 20.04
Exact command line resulting in the issue:
What behaviour did you expect:
What happened instead:

@zhassan-aws zhassan-aws added the aws Bugs or features of importance to AWS CBMC users label Oct 4, 2022
@feliperodri feliperodri added the Kani Bugs or features of importance to Kani Rust Verifier label Oct 6, 2022
@feliperodri
Copy link
Collaborator

tautschnig added a commit to tautschnig/cbmc that referenced this issue Oct 8, 2022
CryptoMiniSat produces assignment output that includes whitespace at the
end of the line. Strip such (empty) elements before evaluating entries
as literals.

Fixes: diffblue#7164
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users Kani Bugs or features of importance to Kani Rust Verifier pending merge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants