Skip to content
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

C++ SimpleRangeAnalysis: remove float bounds #16862

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

d10c
Copy link
Contributor

@d10c d10c commented Jun 27, 2024

This small change should simplify the SimpleRangeAnalysis library down the line by ignoring floats, but it also reduces the precision of some queries.

Some coding standard tests are also expected to fail for the same reason. So I'll leave it to the C/C++ team's discretion whether to move forward in this direction.

Commits:

  • SimpleRangeAnalysis: Remove ±Inf typeBounds for FloatingPointType
  • Update tests

@github-actions github-actions bot added the C++ label Jun 27, 2024
@d10c d10c changed the title SimpleRangeAnalysis: remove float bounds C++ SimpleRangeAnalysis: remove float bounds Jun 27, 2024
@@ -5,7 +5,7 @@
* @kind path-problem
* @problem.severity warning
* @security-severity 8.6
* @precision high
* @precision medium
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reducing the precision of a query from high to medium means it's no longer running as part of Code Scanning. In the past we've not done such drastic changes, so I don't think we should do that as part of this PR.

If you're concerned with the new FP on the query then we could put a barrier on all dataflow nodes with a floating point types in the configuration here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, you can check out the latest commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! That LGTM 🎉

@d10c d10c force-pushed the d10c/simplera-remove-float-bounds branch from f4da707 to fd21a72 Compare July 1, 2024 12:18
d10c added 3 commits July 5, 2024 11:28
If this doesn't break any tests, then this will simplify the rewrite of all SimpleRangeAnalysis floats to BigInt.
We are mostly losing precision due to excluding float operations from range analysis.
This leads to two regressions, but this should be OK if we decide to drop float support from SimpleRangeAnalysis

Keeping high query precision to keep it in code scanning.
@d10c d10c force-pushed the d10c/simplera-remove-float-bounds branch from d4a2c1e to 6589fc5 Compare July 5, 2024 09:28
@d10c d10c marked this pull request as ready for review July 5, 2024 09:28
@d10c d10c requested a review from a team as a code owner July 5, 2024 09:28
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM! I think we should consider adding a minorAnalysis library change note saying something like:
"The SimpleRangeAnalysis library no longer produces type bounds for expressions with floating-point types" (or something like that).

@d10c d10c force-pushed the d10c/simplera-remove-float-bounds branch from 2da7703 to b123901 Compare July 5, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants