-
Notifications
You must be signed in to change notification settings - Fork 273
get-value
errors with the smt2 backend when assertions have quantifiers
#7767
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
@TGWDB I was finally able to reproduce: #include <stdlib.h>
void foo(char *dst, const char *src, size_t n)
__CPROVER_requires(__CPROVER_is_fresh(src, n))
__CPROVER_requires(__CPROVER_is_fresh(dst, n))
__CPROVER_assigns(__CPROVER_object_from(dst))
__CPROVER_ensures(__CPROVER_forall{size_t j; j < n ==> dst[j] == src[j]})
{
for(size_t i = 0; i < n; i++)
__CPROVER_assigns(i, __CPROVER_object_from(dst))
// commenting out the loop invariant to make the analysis fail and reveal the error
// __CPROVER_loop_invariant(i <= n)
// __CPROVER_loop_invariant(__CPROVER_forall{size_t j; j < i ==> dst[j] == src[j]})
{
dst[i] = src[i];
}
}
int main()
{
char *dst;
char *src;
size_t n;
foo(dst, src, n);
return 0;
}
The missing loop invariant makes the post condition fail, and z3 throws an error:
|
Hello, A report on this one since I have been digging into this one for a bit:
|
I can reproduce on Ubuntu 20.04 on WSL. I'll explore/update further later. |
Using lambdas for array comprehension can cause errors in get-value operations later. Fixes #7767
Using lambdas for array comprehension can cause errors in get-value operations later. Fixes #7767
Using lambdas for array comprehension can cause errors in get-value operations later. Fixes #7767
Using lambdas for array comprehension can cause errors in get-value operations later. Fixes #7767
@remi-delmas-3000 The linked draft PR resolves the problem (although it's unclear to me whether we should merge it, I don't know why lambdas should [not] be used for array comprehension). That said, it would be interesting to know the exact environment you're producing the error in, in particular the version(s) of z3. Fotis and I have different results on this and different versions of z3, also sometimes different results with the same version on different architectures/systems. |
Note that further evidence suggests that this is an issue only with older versions of z3, the latest (4.12.2) does not have this problem. We propose closing this issue (and the draft PR) with the recommendation to update to a newer version of z3. |
Hi @TGWDB I could confirm that using z3 v4.12.2 the problem goes away under both linux and macOS, event when using Closing the issue. |
When sending a model with quantifiers in assertions to the SMT backend, when the analysis fails with counter examples, CBMC tries to retrieve the value of all assertions by sending
get-value
to the SMT solver. However in some casesz3
fails on these statements because quantifiers are not supported inget-value
commands.CBMC version:
Operating system:
Exact command line resulting in the issue:
What behaviour did you expect:
What happened instead:
The text was updated successfully, but these errors were encountered: