-
Notifications
You must be signed in to change notification settings - Fork 1.8k
java: inline range test #17997
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
java: inline range test #17997
Changes from 1 commit
15953bf
6ed8950
37935ee
25664d0
f508f8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,30 +6,69 @@ | |||||
import java | ||||||
import semmle.code.java.dataflow.RangeAnalysis | ||||||
private import TestUtilities.InlineExpectationsTest as IET | ||||||
private import semmle.code.java.dataflow.DataFlow | ||||||
|
private import semmle.code.java.dataflow.DataFlow |
Fixed
Show fixed
Hide fixed
Outdated
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.
annotatedBound(e, b, boundExpr, delta, upper) and | |
annotatedBound(e, _, boundExpr, delta, upper) and |
Outdated
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.
This constraint looks very weird. Perhaps something like this would suffice?
(DataFlow::localFlow(DataFlow::exprNode(boundExpr), DataFlow::exprNode(e)) implies delta != 0) | |
not e = b.getExpr() |
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.
I tried that first, but it let through some trivial things. However, it works now...I think I am not used to ensuring the test file compiles all the time... 😅
Uh oh!
There was an error while loading. Please reload this page.
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.
That's not
MISSING
- such a bound would be wrong ifb
is negative or zero, and thus the range analysis won't infer it.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.
Ah, nice. So if I add a guard for
b
being positive, it might appear. Having both versions would be a good illustration of this.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.
I could not get the bound to appear, so now there are just a bunch of negative tests..