-
Notifications
You must be signed in to change notification settings - Fork 75
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
Analysis tracking equality between calls to math library functions to improve invariant #1041
Conversation
I will first start a run of sv-comp on the current master, such that we have a baseline to compare against. |
I started the run with this analysis enabled just now, let's see what the results are! |
Something to consider: What is the relationship of this with the |
This could be combined with |
I did a run on sv-comp but it seems that the analysis sadly does not really make a difference 😞 |
I started another run after the fixes now, let's see if that changes something! |
It might be worth checking with grep if sv-benchmarks even contains such pattern in the first place, or whether it's something that only exists in real-world programs. I didn't look deeply at the implementation, but sv-benchmarks contains many cilled programs, where such transformation could already be hard-coded instead of being introduced by our CIL. Maybe that affects the applicability of this analysis? |
I did a quick search through the sv-comp repository and did only find 1456 files that include As for the transformations already being hardcoded, this should not be a problem. The analysis tracks the equality between a variable and the math descriptor and it does not matter, if the transformation was introduced by CIL or if it was already hardcoded in the code. |
I have implemented the requested changes as well as a better inversion of the The commit prior to the most recent one implements a more conservative way to invert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for sticking with this @FelixKrayer, very happy to see this merged now! 🎉
Awesome! Glad to see it merged after I now finally finished it up. |
I was part of last year's practical course implementing the interval domain for floats. One issue we were unfortunately unable to solve was using certain math library functions in the invariant. Consider the following piece of code:
In this case the check would result in unknown, because the code is transformed into the following where the call to the library function cannot be detected at the if-check. Thus
f
cannot be refined to be finite in this example:This pull request adds a new analysis
TmpSpecial
tracking equalities between lvals and calls to library functions together with the corresponding arguments.Additionally a set of lval is tracked for each equality. This describes the lvals the equality depends on, i.e., lvals contained within the arguments as well as the lval of the assignment. This set is used to delete equalities when an lval it depends on is written.
The information this analysis collects is accessed in the base Invariant via a query to refine arguments of a call. Some examples of this refinement can be seen in regtest 57/19.
TODO:
ceil
andfloor