-
Notifications
You must be signed in to change notification settings - Fork 84
Add proper handling of integer-overflows #121
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
Conversation
This shows a problem in the treatment of operations:
(Excluded (s, r)) op (Definite y)
Excluded(s op y, _) is in general not a correct result value here.
(Where s op y := {x op y | x in s})
This is because there might be an z in gamma(Excluded (s, r)) such that
z op y (mod 2^32)
is in (s op y).
Some overflow checking is needed.
Some preliminary work to store the ikind for abstract integer values. We want to have the ikind available for all abstract integer values, when we perform operations on them, but we don't really want to store the ikind redundantly in each of the integer domain implementations. We introduce a IntDomLifter, that takes a integer domain implementation and adds the ikind information to it. In the future, this IntDomLifter should pass the ikind to the domain operations that need it. This is the reason why we need a separate signature Z for instantiations of the IntDomLifter which is different from the signature S. In the signature Z only the creation of abstract value expects an ikind, but - unlike S - the integer operations itself will not require it. Needs to be reworked inorder not to fail test cases.
…se (taken from def_exc_fix branch)
|
Instead of copying |
|
Instead of carrying |
I think there are places besides the arithmetic operations where we want to know the |
Add top_of and bot_of functions to the IntDomains requiring an ikind as an parameter. Add IntDomWithDefaultIkind functor, that allows to specify of which ikind the values generated by top () and bot () should be.
…ents is of integer type" This reverts commit b830957.
…the right ikind. These are then called by IntDomLifter that keeps the ikind.
|
This causes |
|
I pushed a problematic example where the ikinds don't line up: signed char* s = malloc(10*sizeof(signed char));
s[0] = -5;
unsigned char* us = s;
*us = 12;This is valid C, and GCC also doesn't complain, but we currently fail with This is this issue we discussed where it would be necessary to go to |
In order to implement proper handling of integer overflows in the analyzed C code, and to be able to deal with values outside the range of OCaml-
int64(#120), we have to make several changes to the integer domains.ikindinformation to the integer domains.Regarding 1., I added an functor
IntDomLifter, that takes a module of signatureIntDomain.Sand adds a layer to store the ikind.TODOs:
topandbotshould look like in theIntDomLifter. These either would have to be of some arbitraryikindor some additionalTopandBottomelement