Skip to content

Commit 7e5d539

Browse files
committed
Add a test on which SMT2 fail with quantifers in nested loop contracts
1 parent 582aa69 commit 7e5d539

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <assert.h>
2+
#include <stdbool.h>
3+
4+
#define N 16
5+
6+
void main()
7+
{
8+
int a[N];
9+
a[10] = 0;
10+
bool flag = true;
11+
for(int j = 0; j < N; ++j)
12+
__CPROVER_loop_invariant(j <= N)
13+
{
14+
for(int i = 0; i < N; ++i)
15+
// clang-format off
16+
__CPROVER_assigns(i, __CPROVER_object_whole(a))
17+
__CPROVER_loop_invariant((0 <= i) && (i <= N) && __CPROVER_forall {
18+
int k;
19+
(0 <= k && k <= N) ==> (k<i ==> a[k] == 1)
20+
})
21+
// clang-format on
22+
{
23+
a[i] = 1;
24+
}
25+
}
26+
assert(a[10] == 1);
27+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE dfcc-only
2+
main.c
3+
--dfcc main --apply-loop-contracts _ --smt2
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
^SMT2 solver returned error message:$
7+
^.*\"line \d+ column \d+: unknown constant .*$
8+
^VERIFICATION ERROR$
9+
--
10+
^warning: ignoring
11+
--
12+
This test case checks the handling of quantifiers in a nested loop's
13+
loop contracts.

0 commit comments

Comments
 (0)