-
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.
Clarify usage of history variables in error messages
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
regression/contracts-dfcc/reject_history_expr_in_assertions/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,21 @@ | ||
#include <assert.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
|
||
#define N 16 | ||
|
||
void f(int r[N]) | ||
{ | ||
for(int j = 0; j < N; j++) | ||
{ | ||
int t = r[j]; | ||
__CPROVER_assert(t == __CPROVER_loop_entry(r[j]), "Initial value of r[j]"); | ||
r[j] = t + 1; | ||
} | ||
} | ||
|
||
void main() | ||
{ | ||
int x[N]; | ||
f(x); | ||
} |
11 changes: 11 additions & 0 deletions
11
regression/contracts-dfcc/reject_history_expr_in_assertions/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,11 @@ | ||
CORE | ||
main.c | ||
|
||
^main.c.*error: __CPROVER_loop_entry is not allowed in assume/assert.$ | ||
^CONVERSION ERROR$ | ||
^EXIT=(1|64)$ | ||
^SIGNAL=0$ | ||
-- | ||
-- | ||
This test checks that __CPROVER_loop_entry occurrences in assertions | ||
are detected and rejected. |
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