Skip to content

Commit

Permalink
Add broken proof example from Cerberus repo here
Browse files Browse the repository at this point in the history
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
dc-mak authored and septract committed Aug 2, 2024
1 parent 3453f68 commit 9f6ed55
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/example-archive/should-fail/README.md
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 src/example-archive/should-fail/working/c_sequencing_race.c
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));
}
8 changes: 8 additions & 0 deletions src/example-archive/should-fail/working/letweak01.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

int
f (int x) {
x = (x = 1);

return x + 2;
}

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;
}

0 comments on commit 9f6ed55

Please sign in to comment.