-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Infer loop assigns for DFCC with functions inlined
- Loading branch information
Showing
10 changed files
with
343 additions
and
21 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
regression/contracts-dfcc/loop_assigns_inference-04/main.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,22 @@ | ||
struct hole | ||
{ | ||
int pos; | ||
}; | ||
|
||
void set_len(struct hole *h, unsigned long int new_len) | ||
{ | ||
h->pos = new_len; | ||
} | ||
|
||
int main() | ||
{ | ||
int i = 0; | ||
struct hole h; | ||
h.pos = 0; | ||
for(i = 0; i < 5; i++) | ||
// __CPROVER_assigns(h.pos, i) | ||
__CPROVER_loop_invariant(h.pos == i) | ||
{ | ||
set_len(&h, h.pos + 1); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
regression/contracts-dfcc/loop_assigns_inference-04/test.desc
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 @@ | ||
CORE dfcc-only | ||
main.c | ||
--dfcc main --apply-loop-contracts | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\[main.loop_invariant_base.\d+\] line \d+ Check invariant before entry for loop .*: SUCCESS$ | ||
^\[main.loop_invariant_base.\d+\] line \d+ Check invariant before entry for loop .*: SUCCESS$ | ||
^\[main.loop_invariant_step.\d+\] line \d+ Check invariant after step for loop .*: SUCCESS$ | ||
^\[main.loop_step_unwinding.\d+\] line \d+ Check step was unwound for loop .*: SUCCESS$ | ||
^\[set_len.assigns.\d+\] line \d+ Check that h\-\>pos is assignable: SUCCESS | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
-- | ||
This test checks assigns h->pos is inferred correctly. |
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,22 @@ | ||
struct hole | ||
{ | ||
int pos; | ||
}; | ||
|
||
void set_len(struct hole *h, unsigned long int new_len) | ||
{ | ||
h->pos = new_len; | ||
} | ||
|
||
int main() | ||
{ | ||
int i = 0; | ||
struct hole h; | ||
h.pos = 0; | ||
for(i = 0; i < 5; i++) | ||
// __CPROVER_assigns(h.pos, i) | ||
__CPROVER_loop_invariant(h.pos == i) | ||
{ | ||
set_len(&h, h.pos + 1); | ||
} | ||
} |
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 @@ | ||
CORE | ||
main.c | ||
--apply-loop-contracts | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\[main.\d+\] .* Check loop invariant before entry: SUCCESS$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
-- | ||
This test checks assigns h->pos is inferred correctly. |
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
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
Oops, something went wrong.