-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add broken proof example from Cerberus repo here
The test script in the Cerberus repo doesn't really have a good category for "this is broken, but it should not be". Consequently, placing these tests here makes more sense.
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
This folder contains deliberately incorrect proofs, which are intended to serve | ||
as negative test cases for CN. | ||
as negative test cases for CN, i.e. the ones in `broken` are behaving as | ||
expected and the ones in `working` show a bug of permissiveness which needs fixing. |
10 changes: 10 additions & 0 deletions
10
src/example-archive/should-fail/working/c_sequencing_race.c
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,10 @@ | ||
|
||
|
||
int | ||
f (int *x) | ||
/*@ requires take xv = Owned(x); @*/ | ||
/*@ requires 0i32 <= xv && xv < 500i32; @*/ | ||
/*@ ensures take xv2 = Owned(x); @*/ | ||
{ | ||
return ((*x) + (*x)); | ||
} |
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,8 @@ | ||
|
||
int | ||
f (int x) { | ||
x = (x = 1); | ||
|
||
return x + 2; | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
src/example-archive/simple-examples/broken/error-proof/self_ref_init.c
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,19 @@ | ||
|
||
/* based on a problematic example from linux kvm/pgtable.c */ | ||
|
||
struct str { | ||
int x; | ||
int y; | ||
}; | ||
|
||
int f (int x) | ||
/*@ requires (0i32 <= x) && (x < 200i32); @*/ | ||
{ | ||
struct str str_inst = { | ||
.x = x + 2, | ||
.y = str_inst.x + 3, | ||
}; | ||
|
||
return str_inst.y; | ||
} | ||
|