-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to a more aggressive loop-assigns widening strategy for DFCC
- Loading branch information
Showing
4 changed files
with
36 additions
and
2 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
17 changes: 17 additions & 0 deletions
17
regression/contracts-dfcc/loop_assigns_inference-05/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,17 @@ | ||
#include <stdlib.h> | ||
|
||
#define SIZE 8 | ||
|
||
int main() | ||
{ | ||
int i = 0; | ||
int *j = malloc(SIZE * sizeof(int)); | ||
for(i = 0; i < SIZE; i++) | ||
// __CPROVER_assigns(h.pos, i) | ||
__CPROVER_loop_invariant(0 <= i && i <= SIZE) | ||
{ | ||
int *k; | ||
k = j + i; | ||
*k = 1; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
regression/contracts-dfcc/loop_assigns_inference-05/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,15 @@ | ||
CORE dfcc-only | ||
main.c | ||
--no-malloc-may-fail --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 \*k is assignable: SUCCESS | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
-- | ||
This test checks assigns __CPROVER_object_whole(k) is inferred correctly, | ||
which requires widening *k to the whole object. |
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