-
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
Interval Analysis for Floating-point values #761
Conversation
* add some implementation for the "norm" method in FloatDomain, however at the moment incorrect Now, the norm method is called at eval_binop and successfully fails, which currently is wanted like this, just to test that it works. We need to change it now s.t. it prints a warning instead of an error. * Rework norm slightly s.t. it uses set_overflow_flag now, which however is still incorrect * Add FloatMessage message category in messageCategory.ml Also add it in options.schema.json * Add a todo note for later in sarifRules.ml * Add a regression test for float that expects a warning for division by zeron / infinity * Clean up floatDomain.ml slightly: Remove TODOs/FIXMEs and inline message warning * Fix regression test naming and merge them together * Remove FloatMessage module in messageCategory.ml, as it's not needed anymore * Remove todo message * Remove todo message * Remove todo comments and/or clean up some stuff * Clean up float domain etc. with fixes from PR - Better warning message - use is_top function instead of checking for None in the domain - revert unrelated change - make 'warn.float' option not a default option - make regression test as minimal as possible * In floatDomain.ml, rearrange of_const function s.t. it finds the norm function * Add float warning parameter to 03-infinity_or_nan.c regression test
- lattice related functions (leq, widen, narrow, join, meet) - arithmetic operations (add, sub, mul, div) - casts (f2i, i2f)
* Support FFloat and FDouble - Implement float operators in C - Support FFloat and FDouble * Allow using DBL_MIN, DBL_MAX Some compilers specifiy DBL_MIN, DBL_MAX as long double. As we do not support long double in neither cil nor goblint itself, but want to use DBL_MIN, DBL_MAX, we have no other option than to explicitly check for this two cases
Nice, thanks for the PR! 🚀 I hope to find some time to review it this weekend! I resolved the merge conflicts on the benchmarking machine, and started a run of all of sv-comp on that machine (2min timeout). I'll send you the results on slack. |
Ah, indeed I did not notice that. |
* Find another location where get_ikind results in an error * Further refine determining safe casts with floats
Merge remote
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.
Looks good to be merged from my perspective! Any more comments @sim642 @stilscher @jerhard?
src/cdomains/floatDomain.ml
Outdated
| Interval (r1, r2) when not (is_exact result) && is_exact_before -> | ||
Messages.warn | ||
~category:Messages.Category.Float | ||
~tags:[CWE 197; CWE 681; CWE 1339] |
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.
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.
Yes, I don't think those two really apply here either.
src/cdomains/floatDomain.ml
Outdated
| Top -> | ||
Messages.warn | ||
~category:Messages.Category.Float | ||
~tags:[CWE 197; CWE 681; CWE 1339] |
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.
Same question as above.
CHANGES: Goblint "lean" release after a lot of cleanup. * Remove unmaintained analyses: OSEK, ARINC, shapes, containment, deadlocksByRaces (goblint/analyzer#460, goblint/analyzer#736, goblint/analyzer#812, goblint/analyzer#474). * Add interactive analysis (goblint/analyzer#391). * Add server mode (goblint/analyzer#522). * Add Compilation Database support (goblint/analyzer#406, goblint/analyzer#448). * Add floating point domain, unrolled array domain and improved struct domains (goblint/analyzer#734, goblint/analyzer#761, goblint/analyzer#577, goblint/analyzer#419). * Add static loop unrolling and heap variable unrolling (goblint/analyzer#563, goblint/analyzer#722). * Improve race detection with may-happen-in-parallel analysis (goblint/analyzer#529, goblint/analyzer#518, goblint/analyzer#595). * Reimplement lockset and deadlock analyses (goblint/analyzer#659, goblint/analyzer#662, goblint/analyzer#650, goblint/analyzer#655). * Add pthread extraction to Promela (goblint/analyzer#220). * Add location spans to output (goblint/analyzer#428, goblint/analyzer#449). * Improve race reporting (goblint/analyzer#550, goblint/analyzer#551). * Improve dead code reporting (goblint/analyzer#94, goblint/analyzer#353, goblint/analyzer#785). * Refactor warnings (goblint/analyzer#55, goblint/analyzer#783). * Add JSON schema for configuration (goblint/analyzer#476, goblint/analyzer#499). * Refactor option names (goblint/analyzer#28, goblint/analyzer#192, goblint/analyzer#516, goblint/analyzer#675). * Add bash completion (goblint/analyzer#669). * Add OCaml 4.13 and 4.14 support, remove OCaml 4.09 support (goblint/analyzer#503, goblint/analyzer#672).
CHANGES: Goblint "lean" release after a lot of cleanup. * Remove unmaintained analyses: OSEK, ARINC, shapes, containment, deadlocksByRaces (goblint/analyzer#460, goblint/analyzer#736, goblint/analyzer#812, goblint/analyzer#474). * Add interactive analysis (goblint/analyzer#391). * Add server mode (goblint/analyzer#522). * Add Compilation Database support (goblint/analyzer#406, goblint/analyzer#448). * Add floating point domain, unrolled array domain and improved struct domains (goblint/analyzer#734, goblint/analyzer#761, goblint/analyzer#577, goblint/analyzer#419). * Add static loop unrolling and heap variable unrolling (goblint/analyzer#563, goblint/analyzer#722). * Improve race detection with may-happen-in-parallel analysis (goblint/analyzer#529, goblint/analyzer#518, goblint/analyzer#595). * Reimplement lockset and deadlock analyses (goblint/analyzer#659, goblint/analyzer#662, goblint/analyzer#650, goblint/analyzer#655). * Add pthread extraction to Promela (goblint/analyzer#220). * Add location spans to output (goblint/analyzer#428, goblint/analyzer#449). * Improve race reporting (goblint/analyzer#550, goblint/analyzer#551). * Improve dead code reporting (goblint/analyzer#94, goblint/analyzer#353, goblint/analyzer#785). * Refactor warnings (goblint/analyzer#55, goblint/analyzer#783). * Add JSON schema for configuration (goblint/analyzer#476, goblint/analyzer#499). * Refactor option names (goblint/analyzer#28, goblint/analyzer#192, goblint/analyzer#516, goblint/analyzer#675). * Add bash completion (goblint/analyzer#669). * Add OCaml 4.13 and 4.14 support, remove OCaml 4.09 support (goblint/analyzer#503, goblint/analyzer#672).
Adds basic interval analysis for float and double values (Related to Issue: #734)
We implemented an interval analysis for floating-point values. In order to capture operations leading to unrepresentable values and their rounding mode dependent representations in the concrete execution, all abstract operations overestimate the worst case interval by using the rounding mode that creates the largest possible interval on both bounds.
Introduces following settings:
ana.float.interval
: Enables the float interval domain (default:disabled
)is_nan
,is_normal
,is_finite
,sign
,is_inf
(although we can not use the captured information for more precise information inside branching)cos
,tan
,sin
,...__attribute__((goblint_precision("no-float-interval")))
: to disable/enable the float domain on a node/function levelwarn.float
: Adds warnings related to the analysis results (default:enabled
)