-
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.
C front-end: place requires and ensures in designated scope
These contract clauses may introduce new symbols, which must not conflict with ones declared in the body of the function. Fixes: #8337
- Loading branch information
1 parent
3dcc1c7
commit f008664
Showing
3 changed files
with
50 additions
and
4 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,28 @@ | ||
#define C 8 | ||
|
||
typedef unsigned st[C]; | ||
|
||
// clang-format off | ||
void init_st(st dst) | ||
__CPROVER_requires(__CPROVER_is_fresh(dst, sizeof(st))) | ||
__CPROVER_assigns(__CPROVER_object_whole(dst)) | ||
__CPROVER_ensures(__CPROVER_forall { | ||
unsigned i; (0 <= i && i < C) ==> dst[i] == 0 | ||
}); | ||
// clang-format on | ||
|
||
void init_st(st dst) | ||
{ | ||
__CPROVER_size_t i; | ||
for(i = 0; i < C; i++) | ||
{ | ||
dst[i] = 0; | ||
} | ||
} | ||
|
||
int main() | ||
{ | ||
st dest; | ||
|
||
init_st(dest); | ||
} |
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 @@ | ||
CORE | ||
main.c | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
^CONVERSION ERROR$ |
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