Skip to content

Commit 540b219

Browse files
authored
Merge branch 'diffblue:develop' into develop
2 parents 13d1779 + 83f61a4 commit 540b219

File tree

37 files changed

+681
-125
lines changed

37 files changed

+681
-125
lines changed

CHANGELOG

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# CBMC 6.4.0
2+
3+
This release improves upon automated assigns-clause inference for loop invariants, which should make manually adding assigns clauses to loops less frequent.
4+
5+
## What's Changed
6+
* [CONTRACTS] Support alias of member pointers in loop assigns inference by @qinheping in https://github.com/diffblue/cbmc/pull/8486
7+
* [CONTRACTS] Detect loop locals with goto_rw in DFCC by @qinheping in https://github.com/diffblue/cbmc/pull/8489
8+
* [CONTRACTS] DFCC loop assigns infererence with functions inlined by @qinheping in https://github.com/diffblue/cbmc/pull/8490
9+
10+
## Bug Fixes
11+
* SMT2: implement range type by @kroening in https://github.com/diffblue/cbmc/pull/8466
12+
* Man pages: improve wording of unwinding-related options by @tautschnig in https://github.com/diffblue/cbmc/pull/8471
13+
* `format_type` can now format `range_typet` by @kroening in https://github.com/diffblue/cbmc/pull/8473
14+
* Contracts: document use of __CPROVER_loop_entry with arrays by @tautschnig in https://github.com/diffblue/cbmc/pull/8470
15+
* `bitvector_typet`: set width from mp_integer by @kroening in https://github.com/diffblue/cbmc/pull/8477
16+
* CI: add macos-14 (macOS on M1) job by @tautschnig in https://github.com/diffblue/cbmc/pull/8382
17+
* Remove macos-12 CI job by @tautschnig in https://github.com/diffblue/cbmc/pull/8482
18+
* [CONTRACTS] Support alias of member pointers in loop assigns inference by @qinheping in https://github.com/diffblue/cbmc/pull/8486
19+
* zero extension expression by @kroening in https://github.com/diffblue/cbmc/pull/8442
20+
* [CONTRACTS] Detect loop locals with goto_rw in DFCC by @qinheping in https://github.com/diffblue/cbmc/pull/8489
21+
* [CONTRACTS] DFCC loop assigns infererence with functions inlined by @qinheping in https://github.com/diffblue/cbmc/pull/8490
22+
23+
**Full Changelog**: https://github.com/diffblue/cbmc/compare/cbmc-6.3.1...cbmc-6.4.0
24+
125
# CBMC 6.3.1
226

327
This patch release addresses build failures on Apple Silicon (via PR #8461).

regression/cbmc/Pointer_difference2/test.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ main.c
55
^\[main.pointer.1\] line 8 same object violation in array - other_array: FAILURE$
66
^\[main.assertion.2\] line 11 undefined behavior: FAILURE$
77
^\[main.assertion.3\] line 13 undefined behavior: FAILURE$
8-
^\[main.assertion.7\] line 26 end plus 2 is nondet: FAILURE$
8+
^\[main.assertion.7\] line 26 end plus 2 is nondet: (UNKNOWN|FAILURE)$
99
^\[main.pointer_arithmetic.\d+\] line 26 pointer relation: pointer outside object bounds in p: FAILURE$
10-
^\[main.assertion.8\] line 28 end plus 2 is nondet: FAILURE$
10+
^\[main.assertion.8\] line 28 end plus 2 is nondet: (UNKNOWN|FAILURE)$
1111
^\[main.pointer_arithmetic.\d+\] line 28 pointer relation: pointer outside object bounds in p: FAILURE$
12-
^\*\* 9 of \d+ failed
12+
^\*\* [789] of \d+ failed
1313
^VERIFICATION FAILED$
1414
^EXIT=10$
1515
^SIGNAL=0$

regression/contracts-dfcc/dont_skip_cprover_prefixed_vars_fail/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
void foo()
22
{
3-
int nondet_var;
4-
int __VERIFIER_var;
5-
int __CPROVER_var;
3+
// Initialize them with `nondet_int` to avoid them being ignored by DFCC.
4+
// DFCC ignores variables that are not read/written to outside the loop
5+
// or in the loop contracts.
6+
int nondet_var = nondet_int();
7+
int __VERIFIER_var = nondet_int();
8+
int __CPROVER_var = nondet_int();
69
for(int i = 10; i > 0; i--)
710
// clang-format off
811
__CPROVER_assigns(i)

regression/contracts-dfcc/dont_skip_cprover_prefixed_vars_pass/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
void foo()
22
{
3-
int nondet_var;
4-
int __VERIFIER_var;
5-
int __CPROVER_var;
3+
// Initialize them with `nondet_int` to avoid them being ignored by DFCC.
4+
// DFCC ignores variables that are not read/written to outside the loop
5+
// or in the loop contracts.
6+
int nondet_var = nondet_int();
7+
int __VERIFIER_var = nondet_int();
8+
int __CPROVER_var = nondet_int();
69
for(int i = 10; i > 0; i--)
710
// clang-format off
811
__CPROVER_assigns(i,nondet_var, __VERIFIER_var, __CPROVER_var)

regression/contracts-dfcc/invar_havoc_dynamic_array_const_idx/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void main()
1010
data[4] = 0;
1111

1212
for(unsigned i = 0; i < SIZE; i++)
13-
__CPROVER_loop_invariant(i <= SIZE)
13+
__CPROVER_assigns(data[1], i) __CPROVER_loop_invariant(i <= SIZE)
1414
{
1515
data[1] = i;
1616
}

regression/contracts-dfcc/invar_loop-entry_check/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void main()
1212
x1 = &z1;
1313

1414
while(y1 > 0)
15-
__CPROVER_loop_invariant(*x1 == __CPROVER_loop_entry(*x1))
15+
__CPROVER_loop_invariant(y1 >= 0 && *x1 == __CPROVER_loop_entry(*x1))
1616
{
1717
--y1;
1818
*x1 = *x1 + 1;
@@ -24,7 +24,7 @@ void main()
2424
x2 = z2;
2525

2626
while(y2 > 0)
27-
__CPROVER_loop_invariant(x2 == __CPROVER_loop_entry(x2))
27+
__CPROVER_loop_invariant(y2 >= 0 && x2 == __CPROVER_loop_entry(x2))
2828
{
2929
--y2;
3030
x2 = x2 + 1;
@@ -34,11 +34,12 @@ void main()
3434

3535
int y3;
3636
s s0, s1, *s2 = &s0;
37+
s0.n = malloc(sizeof(int));
3738
s2->n = malloc(sizeof(int));
3839
s1.n = s2->n;
3940

4041
while(y3 > 0)
41-
__CPROVER_loop_invariant(s2->n == __CPROVER_loop_entry(s2->n))
42+
__CPROVER_loop_invariant(y3 >= 0 && s2->n == __CPROVER_loop_entry(s2->n))
4243
{
4344
--y3;
4445
s0.n = s0.n + 1;

regression/contracts-dfcc/invar_loop-entry_check/test.desc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ main.c
1111
^\[main.loop_invariant_base.\d+] line 26 Check invariant before entry for loop .*: SUCCESS$
1212
^\[main.loop_invariant_step.\d+] line 26 Check invariant after step for loop .*: SUCCESS$
1313
^\[main.loop_step_unwinding.\d+] line 26 Check step was unwound for loop .*: SUCCESS$
14-
^\[main.loop_assigns.\d+] line 40 Check assigns clause inclusion for loop .*: SUCCESS$
15-
^\[main.loop_invariant_base.\d+] line 40 Check invariant before entry for loop .*: SUCCESS$
16-
^\[main.loop_invariant_step.\d+] line 40 Check invariant after step for loop .*: SUCCESS$
17-
^\[main.loop_step_unwinding.\d+] line 40 Check step was unwound for loop .*: SUCCESS$
14+
^\[main.loop_assigns.\d+] line 41 Check assigns clause inclusion for loop .*: SUCCESS$
15+
^\[main.loop_invariant_base.\d+] line 41 Check invariant before entry for loop .*: SUCCESS$
16+
^\[main.loop_invariant_step.\d+] line 41 Check invariant after step for loop .*: SUCCESS$
17+
^\[main.loop_step_unwinding.\d+] line 41 Check step was unwound for loop .*: SUCCESS$
1818
^\[main\.assertion\.\d+\] .* assertion \*x1 == z1: SUCCESS$
1919
^\[main\.assertion\.\d+\] .* assertion x2 == z2: SUCCESS$
2020
^\[main.assigns.\d+\] .* Check that y1 is assignable: SUCCESS$

regression/contracts-dfcc/invar_loop-entry_fail/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ void main()
66
x = z;
77

88
while(y > 0)
9-
__CPROVER_loop_invariant(x == __CPROVER_loop_entry(x))
9+
__CPROVER_loop_invariant(y >= 0 && x == __CPROVER_loop_entry(x))
1010
{
1111
--y;
1212
x = x + 1;
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
KNOWNBUG
1+
CORE dfcc-only
22
main.c
3-
--dfcc main --apply-loop-contracts
3+
--dfcc main --apply-loop-contracts _ --no-standard-checks
44
^EXIT=0$
55
^SIGNAL=0$
66
^\[body_1.assigns.\d+\] .* Check that j is assignable: SUCCESS$
77
^\[body_2.assigns.\d+\] .* Check that \*i is assignable: SUCCESS$
88
^\[body_3.assigns.\d+\] .* Check that \*i is assignable: SUCCESS$
99
^\[incr.assigns.\d+\] .* Check that \*i is assignable: SUCCESS$
10-
^\[main.\d+\] .* Check loop invariant before entry: SUCCESS$
11-
^\[main.\d+\] .* Check that loop invariant is preserved: SUCCESS$
10+
^\[main.loop_invariant_base.\d+\] line \d+ Check invariant before entry for loop .*: SUCCESS$
11+
^\[main.loop_invariant_step.\d+\] line \d+ Check invariant after step for loop .*: SUCCESS$
12+
^\[main.loop_step_unwinding.\d+\] line \d+ Check step was unwound for loop .*: SUCCESS$
1213
^\[main.assertion.\d+\] .* assertion j == 9: SUCCESS$
1314
^VERIFICATION SUCCESSFUL$
1415
--
1516
--
1617
This test checks loop locals are correctly removed during assigns inference so
1718
that the assign clause is correctly inferred.
18-
This test failed when using dfcc for loop contracts.

regression/contracts-dfcc/loop_assigns_inference-03/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void main()
77
int b[SIZE];
88
for(unsigned i = 0; i < SIZE; i++)
99
// clang-format off
10-
__CPROVER_loop_invariant(i <= SIZE)
10+
__CPROVER_loop_invariant((i == 0 || b[0] == 1) && i <= SIZE)
1111
// clang-format on
1212
{
1313
b[i] = 1;

0 commit comments

Comments
 (0)