-
Notifications
You must be signed in to change notification settings - Fork 273
Non-termination of CBMC on use of size_t as type of a quantified variable #8365
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
Comments
I also tried it with |
Michael T and I have been looking at this today. See attached. If I change "unsigned int" to "unsigned long", then I get "z3_fails_smt2.txt" and "z3_fails.txt" as the output of z3. It still says "sat", but the following counterexample is different (it contains quantified expressions for a start) which (it appears) causes cbmc to iterate forever. |
Digging further into this I am wondering whether all we need to do is expand on 40bd2b5 to make sure we introduce named functions for all quantified expressions (excluding ones that are nested in another quantified expression). |
With a fix for #8329 and recent Z3 versions (cf. #7767) the problem that remains is Z3 returning results like
Manually adding |
I just built Bitwuzla 0.5.0 from source and, with the proposed fix from #8329, |
I might suggest a two phase approach
|
I have been bi-secting on Z3 versions to see when this change appeared. I find:
BUT
So... something changed between Z3 4.11.2 and 4.12.0. |
More info... If I run cbmc with z3 4.11.2 on the test case above, then the run fails with:
Hmmm... |
Running Z3 4.11.2 by hand on z3_fails.smt2 attached yields actually produces 6 such errors:
|
I am still blocked on this. |
The fix that I'd like to propose for this issue (and also #8326, #8301) has two parts:
|
I like this plan. I assume the failure any affects the "get-value" that follows a "sat" result from Z3, so will only manifest itself as CBCM being unable to generate a counter-example? That's OK, since I will obviously try to fix the failed proof anyway. |
Yes, it should indeed only affect those cases where some property does not hold. |
OK... then the graceful thing to do is to report a proof FAILURE and "sorry.. no counterexample could be found". |
We have seen examples of Z3 responding with ``` ((B1502 (forall ((|main::tmp_cc$0!0@1#0| (_ BitVec 64))) (let ((a!1 (or (and (not (bvule #x000000000000000c |main::tmp_cc$0!0@1#0|)) (bvule #x000000000000000b |main::tmp_cc$0!0@1#0|) [...] ``` when we expected just `true` or `false` as model (which Bitwuzla seemed to get right on the very same input program). Report these as errors rather than using the incomplete assignment. Such an incomplete assignment would make us re-try forever without making progress. Fixes: diffblue#8365
We have seen examples of Z3 responding with ``` ((B1502 (forall ((|main::tmp_cc$0!0@1#0| (_ BitVec 64))) (let ((a!1 (or (and (not (bvule #x000000000000000c |main::tmp_cc$0!0@1#0|)) (bvule #x000000000000000b |main::tmp_cc$0!0@1#0|) [...] ``` when we expected just `true` or `false` as model (which Bitwuzla seemed to get right on the very same input program). Report these as errors rather than using the incomplete assignment. Such an incomplete assignment would make us re-try forever without making progress. Fixes: diffblue#8365
We have seen examples of Z3 responding with ``` ((B1502 (forall ((|main::tmp_cc$0!0@1#0| (_ BitVec 64))) (let ((a!1 (or (and (not (bvule #x000000000000000c |main::tmp_cc$0!0@1#0|)) (bvule #x000000000000000b |main::tmp_cc$0!0@1#0|) [...] ``` when we expected just `true` or `false` as model (which Bitwuzla seemed to get right on the very same input program). Report these as errors rather than using the incomplete assignment. Such an incomplete assignment would make us re-try forever without making progress. Fixes: diffblue#8365
CBMC version: 6.0.1 (with candidate fix for #8329 applied)
Operating system: macOS
Exact command line resulting in the issue: "make"
What behaviour did you expect: successful termination
What happened instead: Non-termination
I have found a better test case that illustrates this issue. Possibly related to #8326.
Test case: https://github.com/rod-chapman/cbmc-examples/tree/main/issues/8365
Note the difference in the two versions of the inner loop invariant. When I use "int" for the type of the quantified variable, all is well and the verification terminates with 1 unproven VC.
When I use "size_t" as the type of the quantified variable, I get:
Hopefully this will yield additional insight into what's going wrong.
The text was updated successfully, but these errors were encountered: