mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
C++: Add test with widening of binary Expr
This commit is contained in:
@@ -582,6 +582,12 @@
|
||||
| test.c:635:9:635:10 | ss | -32768 |
|
||||
| test.c:638:7:638:8 | ss | -32768 |
|
||||
| test.c:639:9:639:10 | ss | -1 |
|
||||
| test.c:645:8:645:8 | s | -2147483648 |
|
||||
| test.c:645:15:645:15 | s | 0 |
|
||||
| test.c:645:23:645:23 | s | 0 |
|
||||
| test.c:646:18:646:18 | s | 0 |
|
||||
| test.c:646:22:646:22 | s | 0 |
|
||||
| test.c:647:9:647:14 | result | 0 |
|
||||
| test.cpp:10:7:10:7 | b | -2147483648 |
|
||||
| test.cpp:11:5:11:5 | x | -2147483648 |
|
||||
| test.cpp:13:10:13:10 | x | -2147483648 |
|
||||
|
||||
@@ -638,4 +638,12 @@ void two_bounds_from_one_test(short ss, unsigned short us) {
|
||||
if (ss + 1 < sizeof(int)) {
|
||||
out(ss); // -1 .. 2
|
||||
}
|
||||
}
|
||||
|
||||
void widen_recursive_expr() {
|
||||
int s;
|
||||
for (s = 0; s < 10; s++) {
|
||||
int result = s + s; // 0 .. 9 [BUG: upper bound is 15 due to widening]
|
||||
out(result); // 0 .. 18 [BUG: upper bound is 30 due to widening]
|
||||
}
|
||||
}
|
||||
@@ -582,6 +582,12 @@
|
||||
| test.c:635:9:635:10 | ss | 32767 |
|
||||
| test.c:638:7:638:8 | ss | 32767 |
|
||||
| test.c:639:9:639:10 | ss | 2 |
|
||||
| test.c:645:8:645:8 | s | 2147483647 |
|
||||
| test.c:645:15:645:15 | s | 127 |
|
||||
| test.c:645:23:645:23 | s | 15 |
|
||||
| test.c:646:18:646:18 | s | 15 |
|
||||
| test.c:646:22:646:22 | s | 15 |
|
||||
| test.c:647:9:647:14 | result | 30 |
|
||||
| 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