-
Notifications
You must be signed in to change notification settings - Fork 76
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 incorrect YAML witness invariant locations from CIL tran…
…sformations (issue #1356)
- Loading branch information
Showing
2 changed files
with
32 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,20 @@ | ||
extern int __VERIFIER_nondet_int(void); | ||
|
||
extern void abort(void); | ||
void assume_abort_if_not(int cond) { | ||
if(!cond) {abort();} | ||
} | ||
|
||
int minus(int a, int b) { | ||
assume_abort_if_not(b <= 0 || a >= b - 2147483648); // there shouldn't be invariants 1 <= b and b != 0 before this line | ||
assume_abort_if_not(b >= 0 || a <= b + 2147483647); // there shouldn't be invariants b <= -1 and b != 0 before this line | ||
return a - b; | ||
} | ||
|
||
int main() { | ||
int x, y; | ||
x = __VERIFIER_nondet_int(); | ||
y = __VERIFIER_nondet_int(); | ||
minus(x, y); | ||
return 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,12 @@ | ||
$ goblint --enable ana.sv-comp.functions --enable ana.int.interval --enable witness.yaml.enabled --set witness.yaml.entry-types '["location_invariant"]' issue-1356.c | ||
[Warning][Integer > Overflow][CWE-190] Signed integer overflow (issue-1356.c:10:3-10:53) | ||
[Warning][Integer > Overflow][CWE-190][CWE-191] Signed integer overflow and underflow (issue-1356.c:11:3-11:15) | ||
[Info][Deadcode] Logical lines of code (LLoC) summary: | ||
live: 13 | ||
dead: 0 | ||
total lines: 13 | ||
[Info][Witness] witness generation summary: | ||
total generation entries: 4 | ||
|
||
$ yamlWitnessStrip < witness.yml | ||
[] |