-
Notifications
You must be signed in to change notification settings - Fork 273
CBMC 6.0.0-preview fails with mal-formed SMT #8329
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
UPDATE:
But the second expression will be converted to
where |
Do you have a simple, reproducible test case? I hope so! Please add and commit that first, so reviewers can see what's going wrong, then see the subsequent commits that correct the behaviour. |
Yes, here is a small test case I reproduced the issue with: #include <assert.h>
#include <stdbool.h>
#define N 16
void main()
{
int a[N];
a[10] = 0;
bool flag = true;
for(int j = 0; j < N; ++j)
__CPROVER_loop_invariant(j <= N)
{
for(int i = 0; i < N; ++i)
__CPROVER_assigns(i, __CPROVER_object_whole(a))
__CPROVER_loop_invariant((0 <= i) && (i <= N) && __CPROVER_forall {
int k;
(0 <= k && k <= N) ==> (k<i ==> a[k] == 1)
})
{
a[i] = 1;
}
}
assert(a[10] == 1);
} Running
will get the error message
|
In the outfile produced with the
The variable |
I tried to reproduce that. I just copied the text above into a file called 8329.c, then:
I'm running CBMC 6.0.0 on macOS... |
Anyway - please add that test case below https://github.com/diffblue/cbmc/tree/develop/regression |
A test added in #8361. |
Indeed... with your issue/8329 branch, version 6.0.1 no longer reports an SMT error, but does not terminate on the "poly_compress" function from the mlkem code:
|
OK... in my cbmc-examples/arrays/ar.c examples file, the "constant_time_equals_total()" function displays the same behaviour - with both cbmc 6.0.0 and your 6.0.1 branch it never terminates. For example
This needs to be fixed for me to make progress with either s2n-tls or mlkem, but I suggest you use this test case for now as it's easily available on GitHub and the result is reproducible without the use of cbmc-viewer or cbmc-starter-kit. OK to close this Issue now as long as this gets picked up elsewhere. |
I have been trying to reproduce this with CBMC 6.0.0 and also using cbmc built from you branch. In doing that, I simplified the test case a bit to this:
The main difference is that I use "size_t" for the loop index variables, and I have simplified inner loop invariant to avoid needed TWO ==> operators. This still crashes CBMC with a similar error:
So something still not right. |
I run this example on the branch which is based on 6.0.1 and didn't see the error. |
If I re-code it like this:
then all proofs are OK using the latest build from your issue/8329 branch. If the loop invariants are too weak, then CBMC tries to generate a counter-example for the final "assert", and we're back to non-termination as in Issue #8365. |
CBMC version: 6.0.0-preview (built from source morning of 14th June)
Operating system: macOS
Exact command line resulting in the issue: make -f desktop.mk
What behaviour did you expect: Correct and complete proof
What happened instead:
CBMC returns some sort of error from the SMT prover - see below for details.
Source code: https://github.com/rod-chapman/mlkem-c-aarch64
Branch: poly_compress_contracts
To reproduce:
See the desktop.mk file for details of how the tools are being invoked.
This results in many ERROR lines in the output, but critically, an earlier error
which I assume is coming back from Z3 ?
The text was updated successfully, but these errors were encountered: