-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add arry-uf options into goto-synthesizer
- Loading branch information
Showing
5 changed files
with
61 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
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,35 @@ | ||
#include <stdlib.h> | ||
|
||
inline int memcmp(const char *s1, const char *s2, unsigned n) | ||
{ | ||
int res = 0; | ||
const unsigned char *sc1 = s1, *sc2 = s2; | ||
for(; n != 0; n--) | ||
// clang-format off | ||
__CPROVER_loop_invariant(n <= __CPROVER_loop_entry(n)) | ||
__CPROVER_loop_invariant(__CPROVER_same_object(sc1, __CPROVER_loop_entry(sc1))) | ||
__CPROVER_loop_invariant(__CPROVER_same_object(sc2, __CPROVER_loop_entry(sc2))) | ||
__CPROVER_loop_invariant(sc1 <= s1 + __CPROVER_loop_entry(n)) | ||
__CPROVER_loop_invariant(sc2 <= s2 + __CPROVER_loop_entry(n)) | ||
__CPROVER_loop_invariant(res == 0) | ||
__CPROVER_loop_invariant(sc1 -(const unsigned char*)s1 == sc2 -(const unsigned char*)s2 | ||
&& sc1 -(const unsigned char*)s1== __CPROVER_loop_entry(n) - n) | ||
// clang-format on | ||
{ | ||
res = (*sc1++) - (*sc2++); | ||
long d1 = sc1 - (const unsigned char *)s1; | ||
long d2 = sc2 - (const unsigned char *)s2; | ||
if(res != 0) | ||
return res; | ||
} | ||
return res; | ||
} | ||
|
||
int main() | ||
{ | ||
const unsigned SIZE = 4096; | ||
unsigned char *a = malloc(SIZE); | ||
unsigned char *b = malloc(SIZE); | ||
memcpy(b, a, SIZE); | ||
assert(memcmp(a, b, SIZE) == 0); | ||
} |
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,11 @@ | ||
CORE | ||
main.c | ||
--pointer-check _ --arrays-uf-always _ --arrays-uf-always | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
Check if the flag --array-uf-always is correctly passed from the synthesizer | ||
to the verifier. Note that there is no loop contracts synthesized in this test. |
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