-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
base: main
Are you sure you want to change the base?
java: inline range test #17997
Conversation
java/ql/test/library-tests/dataflow/range-analysis-inline/range.ql
Outdated
Show resolved
Hide resolved
java/ql/test/library-tests/dataflow/range-analysis-inline/range.ql
Outdated
Show resolved
Hide resolved
java/ql/test/library-tests/dataflow/range-analysis-inline/B.java
Outdated
Show resolved
Hide resolved
|
||
public int forloopexitupd() { | ||
int result = 0; | ||
for (; result < 10; result++) { // $ bound="result in [0..9]" bound="result in [0..10]" |
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.
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 will get that done.
|
||
public int emptyforloop() { | ||
int result = 0; | ||
for (int i = 0; i < 0; i++) { // $ bound="i = 0" bound="i in [0..-1]" |
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.
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.
👍
One of the key features of the range analysis library is the ability to report bounds in terms of SSA variables or interesting expressions such as
But feel free to take or leave this suggestion, depending on how much effort you want to put in, as it's also fine to just merge what's already here in the PR. |
Co-authored-by: Anders Schack-Mulligen <[email protected]>
I think that is a nice idea. The current set of tests is based on my hunt for opportunities to improve range analysis results by rewriting the CFG. But the current PR should rather just present a useful set of tests for range analysis, so I will give this a go :-) |
This adds inline expectation test for the java range analysis.
Feel free to suggest better tests or better syntax.
Pull Request checklist
All query authors
.qhelp
. See the documentation in this repository.Internal query authors only
.ql
,.qll
, or.qhelp
files. See the documentation (internal access required).