Skip to content

Commit 2c9c2aa

Browse files
author
Remi Delmas
committed
Test showing that loop-freeness check detects loops.
1 parent 4514504 commit 2c9c2aa

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+
// clang-format off
2+
int foo(int *arr)
3+
__CPROVER_assigns(*arr)
4+
// clang-format on
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\(goto_program\)$
7+
^Reason: Loops remain in function 'foo', assigns clause checking instrumentation cannot be applied\.$
8+
^EXIT=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)