mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
C++: test for bounded bounds in sign analysis
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
| binary_logical_operator.c:2:11:2:25 | Store: ... && ... | positive strictlyPositive |
|
||||
| binary_logical_operator.c:2:15:2:16 | Constant: 10 | positive strictlyPositive |
|
||||
| binary_logical_operator.c:3:7:3:7 | Load: b | positive |
|
||||
| bounded_bounds.c:3:12:3:12 | Load: x | negative strictlyNegative |
|
||||
| bounded_bounds.c:3:12:3:12 | Store: x | negative strictlyNegative |
|
||||
| bounded_bounds.c:5:7:5:7 | Load: x | positive |
|
||||
| bounded_bounds.c:6:11:6:11 | Load: y | positive strictlyPositive |
|
||||
| bounded_bounds.c:6:11:6:11 | Store: y | positive strictlyPositive |
|
||||
| inline_assembly.c:9:23:9:23 | Uninitialized: definition of y | positive |
|
||||
| inline_assembly.c:10:3:10:7 | Store: ... = ... | positive strictlyPositive |
|
||||
| inline_assembly.c:10:7:10:7 | Constant: (unsigned int)... | positive strictlyPositive |
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
int f(int x, int y) {
|
||||
if (x < 0) {
|
||||
return x;
|
||||
}
|
||||
if (x < y) {
|
||||
return y; // y is strictly positive because of the bound on x above
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user