-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for dead code messages (issue #94)
Automatic testing wasn't possible in #785 (comment), but is now with cram.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <assert.h> | ||
|
||
int main() { | ||
int x; | ||
if (1) | ||
x = 1; | ||
else | ||
x = 2; | ||
if (x) | ||
x = 1; | ||
else | ||
x = 2; | ||
assert(x > 1 && x < 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$ goblint --enable ana.dead-code.lines --enable ana.dead-code.branches issue-94.c | ||
[Error][Assert] Assertion "tmp" will fail. (issue-94.c:13:3-13:35) | ||
[Warning][Deadcode] Function 'main' has dead code: | ||
on line 8 (issue-94.c:8-8) | ||
on line 12 (issue-94.c:12-12) | ||
on line 14 (issue-94.c:14-14) | ||
[Warning][Deadcode] Logical lines of code (LLoC) summary: | ||
live: 6 | ||
dead: 3 | ||
total: 9 | ||
[Warning][Deadcode][CWE-571] condition '1' is always true (issue-94.c:5:7-5:8) | ||
[Warning][Deadcode][CWE-571] condition 'x' is always true (issue-94.c:9:7-9:8) | ||
[Warning][Deadcode][CWE-570] condition 'x > 1' (possibly inserted by CIL) is always false (issue-94.c:13:3-13:35) |