Skip to content

Commit 0c4c1ee

Browse files
author
Remi Delmas
committed
Test showing that loop-freeness check detects loops.
1 parent 0a40ca3 commit 0c4c1ee

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
int foo(int *arr)
2+
// clang-format off
3+
__CPROVER_assigns(__CPROVER_POINTER_OBJECT(arr))
4+
// clang-format off
5+
{
6+
for(int i = 0; i < 10; i++)
7+
arr[i] = i;
8+
9+
return 0;
10+
}
11+
12+
int main()
13+
{
14+
int arr[10];
15+
foo(arr);
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
main.c
3+
--enforce-contract foo
4+
^--- begin invariant violation report ---$
5+
^Invariant check failed$
6+
^Condition: is_loop_free\(.*\)
7+
^Reason: Loops remain in function 'foo', assigns clause checking instrumentation cannot be applied\.$
8+
^EXIT=(127|134)$
9+
^SIGNAL=0$
10+
--
11+
--
12+
This test checks that loops that remain in the program when attempting to
13+
instrument assigns clauses are detected and trigger an INVARIANT.

0 commit comments

Comments
 (0)