Fix --nan-check false positive for finite/+INFINITY division#8745
Open
tautschnig wants to merge 1 commit intodiffblue:developfrom
Open
Fix --nan-check false positive for finite/+INFINITY division#8745tautschnig wants to merge 1 commit intodiffblue:developfrom
tautschnig wants to merge 1 commit intodiffblue:developfrom
Conversation
81bf5e7 to
4e48600
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8745 +/- ##
===========================================
- Coverage 80.01% 80.00% -0.01%
===========================================
Files 1700 1700
Lines 188344 188364 +20
Branches 73 73
===========================================
+ Hits 150701 150710 +9
- Misses 37643 37654 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1871271 to
5578125
Compare
5578125 to
2969dff
Compare
There was a problem hiding this comment.
Pull request overview
Fixes a --nan-check false positive by aligning division NaN detection with IEEE 754 rules (finite/∞ is ±0, only ∞/∞ yields NaN), and adds regressions around infinity arithmetic.
Changes:
- Update NaN-check logic for division to flag only
0/0andinf/inf. - Extend SMT2 parser support with
fp.isNegative/fp.isPositive. - Add/adjust regression tests and math-library stubs for
__isfinite*.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/ieee_float.cpp | Updates division comment to reflect IEEE 754 behavior. |
| src/solvers/smt2/smt2_parser.cpp | Adds parsing for fp.isNegative and fp.isPositive. |
| src/ansi-c/library_check.sh | Excludes __isfinite* symbols from library check list. |
| src/ansi-c/library/math.c | Adds __isfinite, __isfinitef, __isfinitel wrappers. |
| src/ansi-c/goto-conversion/goto_check_c.cpp | Fixes NaN check condition for division (inf/inf only). |
| src/ansi-c/c_typecheck_expr.cpp | Treats __builtin_isfinite as a special function. |
| regression/cbmc/float-nan-check/test.desc | Updates expected NaN-check failure pattern for division. |
| regression/cbmc/float-nan-check/main.c | Adjusts regression to use inf/inf instead of n/inf. |
| regression/cbmc/float-inf-div-inf/test.desc | Adds new regression expectations for inf/inf NaN checks. |
| regression/cbmc/float-inf-div-inf/main.c | New test exercising ±inf / ±inf producing NaN. |
| regression/cbmc/float-finite-div-infinity/test.desc | New regression ensuring finite/∞ does not trigger NaN checks. |
| regression/cbmc/float-finite-div-infinity/main.c | New test asserting finite/∞ results in signed zero. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Update NaN check condition to require infinity in nominator
- Add regression tests to validate IEEE 754 infinity arithmetic
- Support __builtin_isfinite GCC built-in in C front-end
- Add __isfinite{,f,l} models of *BSD functions to C library
- Support fp.is{Negative,Positive} in the in-tree SMT2 solver
Fixes: diffblue#8634
2969dff to
5702d00
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #8634