ultimate-pa / ultimate

The Ultimate program analysis framework.
https://ultimate-pa.org/
200 stars 41 forks source link

Fix translation of __builtin_*_overflow functions #684

Closed schuessf closed 1 month ago

schuessf commented 1 month ago

In GNU C there are functions to check for overflows of arithmetic operations (__builtin_*_overflow). These functions perform an arithmetic operation on the first two arguments (without producing any overflows), write the result to the third argument and return whether an overflow would occur using the normal arithmetic operation. Currently, we simply overapproximate the return value of these functions. This is in general unsound as we do not consider that the third argument changes at all. Also this is quite imprecise, which led to 55 unknown results in SV-COMP 24.

Therefore this PR handles these functions properly. This is done in the following way:

For each of the three cases I added a new method to ExpressionTranslation accordingly, as these cases differ between the integer translation and the bitvector translation.