mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
C++: Fix range analysis bug for 'RemExpr'.
This commit is contained in:
@@ -1064,7 +1064,7 @@ private float getUpperBoundsImpl(Expr expr) {
|
||||
// absolute value. Since `abs(x) = max(-x,x)` this is equivalent to
|
||||
// adding `-rhsLB` to the set of upper bounds.
|
||||
exists(float rhsLB |
|
||||
rhsLB = getFullyConvertedLowerBounds(remExpr.getAnOperand()) and
|
||||
rhsLB = getFullyConvertedLowerBounds(remExpr.getRightOperand()) and
|
||||
not rhsLB >= 0
|
||||
|
|
||||
result = -rhsLB
|
||||
|
||||
@@ -593,7 +593,7 @@
|
||||
| test.c:658:7:658:7 | u | 0 |
|
||||
| test.c:659:9:659:9 | u | 0 |
|
||||
| test.c:664:12:664:12 | s | -2147483648 |
|
||||
| test.c:665:7:665:8 | s2 | -2147483648 |
|
||||
| test.c:665:7:665:8 | s2 | -5 |
|
||||
| test.cpp:10:7:10:7 | b | -2147483648 |
|
||||
| test.cpp:11:5:11:5 | x | -2147483648 |
|
||||
| test.cpp:13:10:13:10 | x | -2147483648 |
|
||||
|
||||
@@ -662,5 +662,5 @@ void guard_bound_out_of_range(void) {
|
||||
|
||||
void test_mod(int s) {
|
||||
int s2 = s % 5;
|
||||
out(s2); // -4 .. 4 [BUG: is -max .. max]
|
||||
out(s2); // -4 .. 4 [BUG: is -5 .. 5]
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@
|
||||
| test.c:658:7:658:7 | u | 0 |
|
||||
| test.c:659:9:659:9 | u | 4294967295 |
|
||||
| test.c:664:12:664:12 | s | 2147483647 |
|
||||
| test.c:665:7:665:8 | s2 | 2147483647 |
|
||||
| test.c:665:7:665:8 | s2 | 5 |
|
||||
| test.cpp:10:7:10:7 | b | 2147483647 |
|
||||
| test.cpp:11:5:11:5 | x | 2147483647 |
|
||||
| test.cpp:13:10:13:10 | x | 2147483647 |
|
||||
|
||||
Reference in New Issue
Block a user