-
Notifications
You must be signed in to change notification settings - Fork 76
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
Improve precision for %
#1156
Comments
After some discussion with Helmut, it seems that just our implementation of |
I would propose dividing this issue into two issues, one to be sound again, which I'll work on and one to restore precision which I'll leave for someone else. |
x % 2
for x
possibly negative but not constant%
Something related to this shows up in our own witness validation in SV-COMP. #include <assert.h>
int main() {
int x;
if (x % 2 == 1) {
assert(x % 2 == 1);
return 1;
}
return 0;
} According to tracing |
|
One way to fix this is to have the guard |
@hseidl and I constructed another example of this issue. // PARAM: --enable ana.int.congruence --enable ana.int.interval --set sem.int.signed_overflow assume_none
#include <goblint.h>
int main()
{
int x,y;
if( y > 0) {
if(x % 3 == 0){
if(x + y == 5) {
// We have x: 2+3ℤ
// But do not make use of it
if(y % 3 == 2) {
// Neither by showing this to be the case in the __goblint_check
__goblint_check(y % 3 == 2);
} else {
// Nor by finding this to be unreachable
}
}
}
}
} |
Goblint claims that this would hold.
For constants it works correctly:
Update: This has now been fixed to be sound in #1161, but remains more imprecise than possible, so we should carefully attempt to make it more precise while remaining sound.
The text was updated successfully, but these errors were encountered: