File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
tests/regression/39-signed-overflows Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ // PARAM: --enable ana.int.interval
2+ #include <limits.h>
3+
4+ int main () {
5+ int bad = INT_MIN % -1 ; // TODO WARN (overflow)
6+ int x , y ;
7+ bad = x % y ; // WARN (div by zero and overflow, distinguished in cram test)
8+ if (y != 0 ) {
9+ bad = x % y ; // TODO WARN (overflow)
10+ }
11+ return 0 ;
12+ }
Original file line number Diff line number Diff line change 1+ TODO: should warn about overflow in all three % -s
2+ $ goblint -- enable warn . deterministic -- enable ana. int . interval 17 -mod-minus-1. c
3+ [Warning][Integer > DivByZero][CWE-369] Second argument of modulo might be zero (17 -mod-minus-1. c: 7 : 5 -7: 16 )
4+ [Info][Deadcode] Logical lines of code (LLoC) summary:
5+ live: 6
6+ dead: 0
7+ total lines : 6
8+
9+ TODO: should warn about overflow in all three % -s
10+ $ goblint -- enable warn . deterministic -- enable ana. int . interval_set 17 -mod-minus-1. c
11+ [Warning][Integer > DivByZero][CWE-369] Second argument of modulo might be zero (17 -mod-minus-1. c: 7 : 5 -7: 16 )
12+ [Info][Deadcode] Logical lines of code (LLoC) summary:
13+ live: 6
14+ dead: 0
15+ total lines : 6
16+
You can’t perform that action at this time.
0 commit comments