Skip to content

Incorrect results with an external SAT solver #7424

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 Dec 9, 2022 · 1 comment
Closed

Incorrect results with an external SAT solver #7424

zhassan-aws opened this issue Dec 9, 2022 · 1 comment
Labels
aws-medium Kani Bugs or features of importance to Kani Rust Verifier

Comments

@zhassan-aws
Copy link
Collaborator

On the following program:

#include <assert.h>

int main() {
  int x[1];
  x[0] = 0;
  int y;
  if (y >= 0 && y < 1) {
    assert(0);
    assert(x[y] == y);
  }
  return 0;
}

If I run this with the default SAT solver, I get one failure as expected:

$ cbmc test.c
CBMC version 5.72.0 (cbmc-5.72.0) 64-bit x86_64 linux
Parsing test.c
Converting
Type-checking test
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.000713953s
size of program expression: 42 steps
simple slicing removed 5 assignments
Generated 2 VCC(s), 2 remaining after simplification
Runtime Postprocess Equation: 9.651e-06s
Passing problem to propositional reduction
converting SSA
Runtime Convert SSA: 0.000365267s
Running propositional reduction
Post-processing
Runtime Post-process: 2.2591e-05s
Solving with MiniSAT 2.2.1 with simplifier
388 variables, 629 clauses
SAT checker: instance is SATISFIABLE
Runtime Solver: 0.000265702s
Runtime decision procedure: 0.000671191s
Running propositional reduction
Solving with MiniSAT 2.2.1 with simplifier
388 variables, 0 clauses
SAT checker inconsistent: instance is UNSATISFIABLE
Runtime Solver: 5.92e-06s
Runtime decision procedure: 1.2e-05s

** Results:
test.c function main
[main.assertion.1] line 8 assertion 0: FAILURE
[main.assertion.2] line 9 assertion x[y] == y: SUCCESS

** 1 of 2 failed (2 iterations)
VERIFICATION FAILED

But if I run it with kissat , both assertions fail:

$ cbmc test.c --external-sat-solver kissat
CBMC version 5.72.0 (cbmc-5.72.0) 64-bit x86_64 linux
Parsing test.c
Converting
Type-checking test
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.000781506s
size of program expression: 42 steps
simple slicing removed 5 assignments
Generated 2 VCC(s), 2 remaining after simplification
Runtime Postprocess Equation: 1.9751e-05s
Passing problem to propositional reduction
converting SSA
Runtime Convert SSA: 0.000206609s
Running propositional reduction
Post-processing
Runtime Post-process: 1.349e-05s
Solving with External SAT solver
Writing temporary CNF
Invoking SAT solver
Solver returned code: 10
result:SATISFIABLE
Runtime Solver: 0.00189018s
Runtime decision procedure: 0.00215949s
Running propositional reduction
Solving with External SAT solver
Writing temporary CNF
Invoking SAT solver
Solver returned code: 10
result:SATISFIABLE
Runtime Solver: 0.00140601s
Runtime decision procedure: 0.00143316s

** Results:
test.c function main
[main.assertion.1] line 8 assertion 0: FAILURE
[main.assertion.2] line 9 assertion x[y] == y: FAILURE

** 2 of 2 failed (3 iterations)
VERIFICATION FAILED

The same thing happens if I run it with cadical or cryptominisat.

CBMC version: 5.72.0
Operating system: Ubuntu 18.04

@zhassan-aws
Copy link
Collaborator Author

Duplicate of #7416. Closing. Will post the C Program there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-medium Kani Bugs or features of importance to Kani Rust Verifier
Projects
None yet
Development

No branches or pull requests

1 participant