File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 588588| test.c:646:18:646:18 | s | 0 |
589589| test.c:646:22:646:22 | s | 0 |
590590| test.c:647:9:647:14 | result | 0 |
591+ | test.c:653:7:653:7 | i | 0 |
592+ | test.c:654:9:654:9 | i | -2147483648 |
593+ | test.c:658:7:658:7 | u | 0 |
594+ | test.c:659:9:659:9 | u | 0 |
591595| test.cpp:10:7:10:7 | b | -2147483648 |
592596| test.cpp:11:5:11:5 | x | -2147483648 |
593597| test.cpp:13:10:13:10 | x | -2147483648 |
Original file line number Diff line number Diff line change @@ -646,4 +646,16 @@ void widen_recursive_expr() {
646646 int result = s + s ; // 0 .. 9 [BUG: upper bound is 15 due to widening]
647647 out (result ); // 0 .. 18 [BUG: upper bound is 127 due to double widening]
648648 }
649- }
649+ }
650+
651+ void guard_bound_out_of_range (void ) {
652+ int i = 0 ;
653+ if (i < 0 ) {
654+ out (i ); // unreachable [BUG: is -max .. +max]
655+ }
656+
657+ unsigned int u = 0 ;
658+ if (u < 0 ) {
659+ out (u ); // unreachable [BUG: is 0 .. +max]
660+ }
661+ }
Original file line number Diff line number Diff line change 588588| test.c:646:18:646:18 | s | 15 |
589589| test.c:646:22:646:22 | s | 15 |
590590| test.c:647:9:647:14 | result | 127 |
591+ | test.c:653:7:653:7 | i | 0 |
592+ | test.c:654:9:654:9 | i | 2147483647 |
593+ | test.c:658:7:658:7 | u | 0 |
594+ | test.c:659:9:659:9 | u | 4294967295 |
591595| test.cpp:10:7:10:7 | b | 2147483647 |
592596| test.cpp:11:5:11:5 | x | 2147483647 |
593597| test.cpp:13:10:13:10 | x | 2147483647 |
You can’t perform that action at this time.
0 commit comments