-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Add support for constant bound modulus operations #12655
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
Conversation
a71f5a6
to
de22182
Compare
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 seems very sensible, but I'm wondering if it makes more sense to add this case in boundFlowStep
(and call bounded
recursively on the right-hand side)? I guess this would also handle a case such as:
int n = b ? 10 : 20;
range(unknown() % n)
?
cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/RangeAnalysisStage.qll
Outdated
Show resolved
Hide resolved
I'm not sure how to do this. How would this interact with a bound on the left-hand side? I'm not sure how to check whether that bound is missing or not. I started to run into non-monotonic recursion. |
Or should I just completely ignore any bound coming from the left-hand side? |
I think so, yes. I think that's what SimpleRangeAnalysis is also doing. |
Move to |
I just noticed that |
I'm not sure how. I also having a hard time believing those bound by the way. It's not immediately clear to me why they would be correct. |
Since one of the two
Hm, I don't see what's wrong with those bounds. If |
Ah. I don't think I was reading the code correctly. I'll have another look. |
@MathiasVP Updated the PR and ran a new DCA experiment (which looks ok to me). |
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.
LGTM!
No description provided.