mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #14588 from aschackmull/shared/rangeanalysis
C++/Java: Share core range analysis
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
while (f3_get(n)) n+=2;
|
||||
|
||||
for (int i = 0; i < n; i += 2) {
|
||||
range(i); // $ range=>=0 SPURIOUS: range="<=Phi: call to f3_get-1" range="<=Phi: call to f3_get-2"
|
||||
range(i); // $ range=>=0 range="<=Phi: call to f3_get-2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,3 +117,16 @@ void test_sub(int x, int y, int n) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void test_div(int x) {
|
||||
if (3 <= x && x <= 7) {
|
||||
range(x / 2); // $ range=>=1 range=<=3
|
||||
range(x / 3); // $ range=>=1 range=<=2
|
||||
range(x >> 2); // $ range=>=0 range=<=1
|
||||
}
|
||||
if (2 <= x && x <= 8) {
|
||||
range(x / 2); // $ range=>=1 range=<=4
|
||||
range(x / 3); // $ range=>=0 range=<=2
|
||||
range(x >> 2); // $ range=>=0 range=<=2
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user