File tree Expand file tree Collapse file tree 10 files changed +40
-24
lines changed
invar_havoc_dynamic_array
invar_havoc_static_multi-dim_array_partial_const_idx Expand file tree Collapse file tree 10 files changed +40
-24
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ void main()
9
9
data [5 ] = 0 ;
10
10
11
11
for (unsigned i = 0 ; i < SIZE ; i ++ )
12
+ __CPROVER_assigns (i , __CPROVER_POINTER_OBJECT (data ))
12
13
__CPROVER_loop_invariant (i <= SIZE )
13
14
{
14
15
data [i ] = 1 ;
Original file line number Diff line number Diff line change 3
3
--apply-loop-contracts
4
4
^EXIT=10$
5
5
^SIGNAL=0$
6
- ^\[main.1\] .* Check loop invariant before entry: SUCCESS$
7
- ^\[main.2\] .* Check that loop invariant is preserved: SUCCESS$
8
- ^\[main.assertion.1\] .* assertion data\[5\] == 0: FAILURE$
9
- ^\[main.assertion.2\] .* assertion data\[5\] == 1: FAILURE$
6
+ ^\[main\.\d+\] .* Check loop invariant before entry: SUCCESS$
7
+ ^\[main\.\d+\] .* Check that loop invariant is preserved: SUCCESS$
8
+ ^\[main\.\d+\] .* Check that i is assignable: SUCCESS$
9
+ ^\[main\.\d+\] .* Check that data\[\(signed long (long )?int\)i\] is assignable: SUCCESS$
10
+ ^\[main\.assertion\.\d+\] .* assertion data\[5\] == 0: FAILURE$
11
+ ^\[main\.assertion\.\d+\] .* assertion data\[5\] == 1: FAILURE$
10
12
^VERIFICATION FAILED$
11
13
--
12
14
--
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ void main()
11
11
data [4 ][5 ][6 ] = 0 ;
12
12
13
13
for (unsigned i = 0 ; i < SIZE ; i ++ )
14
- __CPROVER_loop_invariant (i <= SIZE )
14
+ __CPROVER_assigns (i , __CPROVER_POINTER_OBJECT (data ))
15
+ __CPROVER_loop_invariant (i <= SIZE )
15
16
{
16
17
data [4 ][i ][6 ] = 1 ;
17
18
}
Original file line number Diff line number Diff line change 3
3
--apply-loop-contracts
4
4
^EXIT=10$
5
5
^SIGNAL=0$
6
- ^\[main.1\] .* Check loop invariant before entry: SUCCESS$
7
- ^\[main.2\] .* Check that loop invariant is preserved: SUCCESS$
8
- ^\[main.assertion.1\] .* assertion data\[1\]\[2\]\[3\] == 0: FAILURE$
9
- ^\[main.assertion.2\] .* assertion data\[4\]\[5\]\[6\] == 0: FAILURE$
6
+ ^\[main\.\d+\] .* Check loop invariant before entry: SUCCESS$
7
+ ^\[main\.\d+\] .* Check that loop invariant is preserved: SUCCESS$
8
+ ^\[main\.\d+\] .* Check that i is assignable: SUCCESS$
9
+ ^\[main\.\d+\] .* Check that data\[\(signed long int\)4\]\[\(signed long int\)i\]\[\(signed long int\)6\] is assignable: SUCCESS$
10
+ ^\[main\.assertion\.\d+\] .* assertion data\[1\]\[2\]\[3\] == 0: FAILURE$
11
+ ^\[main\.assertion\.\d+\] .* assertion data\[4\]\[5\]\[6\] == 0: FAILURE$
10
12
^VERIFICATION FAILED$
11
13
--
12
14
--
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ void main()
9
9
10
10
for (int i = 0 ; i < N ; ++ i )
11
11
// clang-format off
12
+ __CPROVER_assigns (i , __CPROVER_POINTER_OBJECT (a ))
12
13
__CPROVER_loop_invariant (
13
14
(0 <= i ) && (i <= N ) &&
14
15
__CPROVER_forall {
Original file line number Diff line number Diff line change 1
1
CORE
2
2
main.c
3
- --apply-loop-contracts
3
+ --apply-loop-contracts _ --trace
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.1\] line .* Check loop invariant before entry: SUCCESS
7
- ^\[main.2\] line .* Check that loop invariant is preserved: SUCCESS
8
- ^\[main.assertion.1\] line .* assertion a\[10\] == 1: SUCCESS
6
+ ^\[main\.\d+\] line .* Check loop invariant before entry: SUCCESS$
7
+ ^\[main\.\d+\] line .* Check that loop invariant is preserved: SUCCESS$
8
+ ^\[main\.\d+\] line .* Check that i is assignable: SUCCESS$
9
+ ^\[main\.\d+\] line .* Check that a\[\(signed long (long )?int\)i\] is assignable: SUCCESS$
10
+ ^\[main\.assertion\.\d+\] line .* assertion a\[10\] == 1: SUCCESS$
9
11
^VERIFICATION SUCCESSFUL$
10
12
--
11
13
^warning: ignoring
Original file line number Diff line number Diff line change 1
1
#include <assert.h>
2
2
3
+ const int MAX = 3 ;
3
4
void main ()
4
5
{
5
- int N , a [64 ];
6
- __CPROVER_assume (0 <= N && N < 64 );
6
+ int N , a [MAX ];
7
+ __CPROVER_assume (0 <= N && N < MAX );
7
8
8
9
for (int i = 0 ; i < N ; ++ i )
9
10
// clang-format off
11
+ __CPROVER_assigns (i , __CPROVER_POINTER_OBJECT (a ))
10
12
__CPROVER_loop_invariant (
11
13
(0 <= i ) && (i <= N ) &&
12
14
__CPROVER_forall {
Original file line number Diff line number Diff line change 1
- CORE smt-backend broken-cprover-smt-backend
1
+ CORE smt-backend broken-cprover-smt-backend thorough-smt-backend
2
2
main.c
3
3
--apply-loop-contracts _ --z3
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.\d+\] line .* Check loop invariant before entry: SUCCESS
7
- ^\[main.\d+\] line .* Check that loop invariant is preserved: SUCCESS
8
- ^\[main.assertion.\d+\] line .* assertion .*: SUCCESS
6
+ ^\[main.\d+\] line .* Check loop invariant before entry: SUCCESS$
7
+ ^\[main.\d+\] line .* Check that loop invariant is preserved: SUCCESS$
8
+ ^\[main\.\d+\] line .* Check that i is assignable: SUCCESS$
9
+ ^\[main\.\d+\] line .* Check that a\[\(signed long (long )?int\)i\] is assignable: SUCCESS$
10
+ ^\[main.assertion.\d+\] line .* assertion .*: SUCCESS$
9
11
^VERIFICATION SUCCESSFUL$
10
12
--
11
13
^warning: ignoring
Original file line number Diff line number Diff line change 6
6
void main ()
7
7
{
8
8
unsigned N ;
9
- __CPROVER_assume (N <= MAX_SIZE );
9
+ __CPROVER_assume (0 < N && N <= MAX_SIZE );
10
10
11
11
int * a = malloc (N * sizeof (int ));
12
12
13
13
for (int i = 0 ; i < N ; ++ i )
14
14
// clang-format off
15
+ __CPROVER_assigns (i , __CPROVER_POINTER_OBJECT (a ))
15
16
__CPROVER_loop_invariant (
16
17
(0 <= i ) && (i <= N ) &&
17
18
(i != 0 == > __CPROVER_exists {
Original file line number Diff line number Diff line change 1
1
CORE
2
2
main.c
3
- --apply-loop-contracts
3
+ --apply-loop-contracts _ --trace
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[main.1\] line .* Check loop invariant before entry: SUCCESS
7
- ^\[main.2\] line .* Check that loop invariant is preserved: SUCCESS
8
- ^\[main.assertion.1\] line .* assertion .*: SUCCESS
6
+ ^\[main\.\d+\] .* Check loop invariant before entry: SUCCESS$
7
+ ^\[main\.\d+\] .* Check that loop invariant is preserved: SUCCESS$
8
+ ^\[main\.\d+\] .* Check that i is assignable: SUCCESS$
9
+ ^\[main\.\d+\] .* Check that a\[\(signed long (long )?int\)i\] is assignable: SUCCESS$
10
+ ^\[main\.assertion\.\d+\] line .* assertion .*: SUCCESS$
9
11
^VERIFICATION SUCCESSFUL$
10
12
--
11
13
^warning: ignoring
You can’t perform that action at this time.
0 commit comments