File tree Expand file tree Collapse file tree 14 files changed +4
-40
lines changed
assigns_enforce_free_dead
assigns_enforce_structs_04
assigns_enforce_subfunction_calls
assigns_type_checking_valid_cases
assigns_validity_pointer_02
history-pointer-enforce-10
test_aliasing_ensure_indirect Expand file tree Collapse file tree 14 files changed +4
-40
lines changed Original file line number Diff line number Diff line change 3
3
--enforce-contract f1
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[f1.\d+\] line \d+ Check that x2 is assignable: SUCCESS$
7
- ^\[f1.\d+\] line \d+ Check that y2 is assignable: SUCCESS$
8
- ^\[f1.\d+\] line \d+ Check that z2 is assignable: SUCCESS$
9
- ^\[f2.\d+\] line \d+ Check that x3 is assignable: SUCCESS$
10
- ^\[f2.\d+\] line \d+ Check that y3 is assignable: SUCCESS$
11
- ^\[f2.\d+\] line \d+ Check that z3 is assignable: SUCCESS$
12
6
^\[f3.\d+\] line \d+ Check that \*x3 is assignable: SUCCESS$
13
7
^\[f3.\d+\] line \d+ Check that \*y3 is assignable: SUCCESS$
14
8
^\[f3.\d+\] line \d+ Check that \*z3 is assignable: SUCCESS$
Original file line number Diff line number Diff line change 3
3
--enforce-contract f1 --enforce-contract f2 --enforce-contract f3
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[f1.1\] line \d+ .*: SUCCESS$
7
6
^VERIFICATION SUCCESSFUL$
8
7
--
9
8
--
Original file line number Diff line number Diff line change 7
7
^\[bar.\d+\] line \d+ Check that \*b is assignable: SUCCESS$
8
8
^\[baz.\d+\] line \d+ Check that POINTER_OBJECT\(\(void \*\)c\) is assignable: FAILURE$
9
9
^\[baz.\d+\] line \d+ Check that \*a is assignable: SUCCESS$
10
- ^\[foo.\d+\] line \d+ Check that a is assignable: SUCCESS$
11
10
^\[foo.\d+\] line \d+ Check that yp is assignable: SUCCESS$
12
11
^\[foo.\d+\] line \d+ Check that z is assignable: SUCCESS$
13
12
^\[foo.\d+\] line \d+ Check that \*xp is assignable: SUCCESS$
Original file line number Diff line number Diff line change 6
6
main.c function bar
7
7
^\[bar.\d+\] line \d+ Check that \*y is assignable: SUCCESS$
8
8
^\[bar.\d+\] line \d+ Check that x is assignable: FAILURE$
9
- ^\[baz.\d+\] line \d+ Check that w is assignable: SUCCESS$
10
- ^\[foo.\d+\] line \d+ Check that w is assignable: SUCCESS$
11
- ^\[foo.\d+\] line \d+ Check that z is assignable: SUCCESS$
12
9
^VERIFICATION FAILED$
13
10
--
14
11
--
Original file line number Diff line number Diff line change 10
10
^\[foo.\d+\] line \d+ Check that a is assignable: SUCCESS$
11
11
^\[foo.\d+\] line \d+ Check that q is assignable: SUCCESS$
12
12
^\[foo.\d+\] line \d+ Check that w is assignable: SUCCESS$
13
- ^\[foo.\d+\] line \d+ Check that x is assignable: SUCCESS$
14
13
^\[foo.\d+\] line \d+ Check that y is assignable: SUCCESS$
15
14
^\[foo.\d+\] line \d+ Check that z is assignable: SUCCESS$
16
15
^\[foo.\d+\] line \d+ Check that POINTER_OBJECT\(\(void \*\)z\) is assignable: SUCCESS$
25
24
^\[foo.\d+\] line \d+ Check that a is assignable: FAILURE$
26
25
^\[foo.\d+\] line \d+ Check that q is assignable: FAILURE$
27
26
^\[foo.\d+\] line \d+ Check that w is assignable: FAILURE$
28
- ^\[foo.\d+\] line \d+ Check that x is assignable: FAILURE$
29
27
^\[foo.\d+\] line \d+ Check that y is assignable: FAILURE$
30
28
^\[foo.\d+\] line \d+ Check that z is assignable: FAILURE$
31
29
^\[foo.\d+\] line \d+ Check that POINTER_OBJECT\(\(void \*\)z\) is assignable: FAILURE$
Original file line number Diff line number Diff line change 6
6
^\[f1.\d+\] line \d+ Check that p->y is assignable: FAILURE$
7
7
^\[f2.\d+\] line \d+ Check that p->x is assignable: FAILURE$
8
8
^\[f3.\d+\] line \d+ Check that p->y is assignable: SUCCESS$
9
- ^\[f4.\d+\] line \d+ Check that p is assignable: SUCCESS$
10
9
^VERIFICATION FAILED$
11
10
--
12
11
--
Original file line number Diff line number Diff line change 3
3
--enforce-contract foo
4
4
^EXIT=10$
5
5
^SIGNAL=0$
6
- ^main.c function bar$
7
- ^\[bar.1\] line \d+ Check that x is assignable: SUCCESS$
8
- ^\[bar.2\] line \d+ Check that y is assignable: SUCCESS$
9
- ^\[bar.3\] line \d+ Check that x is assignable: SUCCESS$
10
- ^\[bar.4\] line \d+ Check that y is assignable: SUCCESS$
11
6
^main.c function baz$
12
7
^\[baz.1\] line \d+ Check that \*x is assignable: SUCCESS$
13
8
^\[baz.2\] line \d+ Check that \*x is assignable: SUCCESS$
14
9
^\[baz.3\] line \d+ Check that \*x is assignable: FAILURE$
15
10
^\[baz.4\] line \d+ Check that \*x is assignable: FAILURE$
16
11
^main.c function foo$
17
- ^\[foo.1\] line \d+ Check that x is assignable: SUCCESS$
18
- ^\[foo.2\] line \d+ Check that y is assignable: SUCCESS$
19
12
^\[foo.assertion.1\] line \d+ foo.x.set: SUCCESS$
20
- ^\[foo.3\] line \d+ Check that x is assignable: SUCCESS$
21
- ^\[foo.4\] line \d+ Check that y is assignable: SUCCESS$
22
13
^\[foo.assertion.2\] line \d+ foo.local.set: SUCCESS$
23
- ^\[foo.5\] line \d+ Check that x is assignable: SUCCESS$
24
- ^\[foo.6\] line \d+ Check that y is assignable: SUCCESS$
25
14
^\[foo.assertion.3\] line \d+ foo.y.set: SUCCESS$
26
- ^\[foo.7\] line \d+ Check that x is assignable: SUCCESS$
27
- ^\[foo.8\] line \d+ Check that y is assignable: SUCCESS$
28
15
^\[foo.assertion.4\] line \d+ foo.z.set: SUCCESS$
29
16
^VERIFICATION FAILED$
30
17
--
Original file line number Diff line number Diff line change 3
3
--enforce-contract bar
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[bar.1\] line \d+ Check that fun\_ptr is assignable: SUCCESS$
7
6
^\[main.assertion.\d+\] line \d+ assertion x \=\= 0: SUCCESS$
8
7
^\[main.assertion.\d+\] line \d+ assertion x \=\= 1: SUCCESS$
9
8
^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change 3
3
--enforce-contract foo1 --enforce-contract foo2 --enforce-contract foo3 --enforce-contract foo4 --enforce-contract foo5 --enforce-contract foo6 --enforce-contract foo7 --enforce-contract foo8 --enforce-contract foo9 --enforce-contract foo10 _ --pointer-primitive-check
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
- ^\[foo1.\d+\] line \d+ Check that a is assignable: SUCCESS$
7
6
^\[foo10.\d+\] line \d+ Check that buffer->len is assignable: SUCCESS$
8
7
^\[foo10.\d+\] line \d+ Check that buffer->aux\.allocated is assignable: SUCCESS$
9
- ^\[foo2.\d+\] line \d+ Check that b is assignable: SUCCESS$
10
- ^\[foo3.\d+\] line \d+ Check that b is assignable: SUCCESS$
11
8
^\[foo3.\d+\] line \d+ Check that y is assignable: SUCCESS$
12
- ^\[foo4.\d+\] line \d+ Check that b is assignable: SUCCESS$
13
9
^\[foo4.\d+\] line \d+ Check that \*c is assignable: SUCCESS$
14
10
^\[foo4.\d+\] line \d+ Check that \*x is assignable: SUCCESS$
15
11
^\[foo5.\d+\] line \d+ Check that buffer.data is assignable: SUCCESS$
28
24
^\[foo8.\d+\] line \d+ Check that array\[\(.* int\)7\] is assignable: SUCCESS$
29
25
^\[foo8.\d+\] line \d+ Check that array\[\(.* int\)8\] is assignable: SUCCESS$
30
26
^\[foo8.\d+\] line \d+ Check that array\[\(.* int\)9\] is assignable: SUCCESS$
31
- ^\[foo9.\d+\] line \d+ Check that array is assignable: SUCCESS$
32
27
^VERIFICATION SUCCESSFUL$
33
28
--
34
29
Checks whether CBMC parses correctly all standard cases for assigns clauses.
Original file line number Diff line number Diff line change 7
7
^\[bar.\d+\] line \d+ Check that \*x is assignable: SUCCESS$
8
8
^\[bar.\d+\] line \d+ Check that \*y is assignable: SUCCESS$
9
9
^\[baz.\d+\] line \d+ Check that \*z is assignable: SUCCESS$
10
- ^\[foo.\d+\] line \d+ Check that x is assignable: SUCCESS$
11
- ^\[foo.\d+\] line \d+ Check that y is assignable: SUCCESS$
12
10
^\[foo.\d+\] line \d+ Check that \*x is assignable: SUCCESS$
13
11
^VERIFICATION SUCCESSFUL$
14
12
--
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ void bar(struct pair *p) __CPROVER_assigns(p->y)
23
23
p -> y = (p -> y + 5 );
24
24
}
25
25
26
- void baz (struct pair p ) __CPROVER_assigns (p )
26
+ void baz (struct pair p ) __CPROVER_assigns ()
27
27
__CPROVER_ensures (p == __CPROVER_old (p ))
28
28
{
29
29
struct pair pp = p ;
Original file line number Diff line number Diff line change 7
7
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
8
8
^\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS$
9
9
^\[bar.\d+\] line \d+ Check that p->y is assignable: SUCCESS$
10
- ^\[baz.\d+\] line \d+ Check that p is assignable: SUCCESS$
11
- ^\[baz.\d+\] line \d+ Check that p is assignable: SUCCESS$
12
10
^\[foo.\d+\] line \d+ Check that \*p->y is assignable: SUCCESS$
13
11
^\[foo.\d+\] line \d+ Check that z is assignable: SUCCESS$
14
12
^\[main.assertion.\d+\] line \d+ assertion \*\(p->y\) == 7: SUCCESS$
19
17
This test checks that history variables are supported for structs, symbols, and
20
18
struct members. By using the --enforce-contract flag, the postcondition
21
19
(with history variable) is asserted. In this case, this assertion should pass.
20
+ Note: A function is always authorized to assign the variables that store
21
+ its arguments, there is no need to mention them in the assigns clause.
Original file line number Diff line number Diff line change 2
2
#include <stdbool.h>
3
3
#include <stdlib.h>
4
4
5
- void bar (int * z ) __CPROVER_assigns (z )
5
+ void bar (int * z ) __CPROVER_assigns ()
6
6
__CPROVER_ensures (__CPROVER_is_fresh (z , sizeof (int )))
7
7
{
8
8
z = malloc (sizeof (* z ));
Original file line number Diff line number Diff line change 4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
6
\[postcondition.\d+\] file main.c line \d+ Check ensures clause: SUCCESS
7
- \[bar.\d+\] line \d+ Check that z is assignable: SUCCESS
8
7
\[foo.\d+\] line \d+ Check that \*x is assignable: SUCCESS
9
8
\[main.assertion.\d+\] line \d+ assertion \!\(n \< 4\): SUCCESS
10
9
^VERIFICATION SUCCESSFUL$
You can’t perform that action at this time.
0 commit comments