Skip to content

Commit d85b674

Browse files
committed
state encoding
1 parent 78aa8a0 commit d85b674

File tree

396 files changed

+10905
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

396 files changed

+10905
-28
lines changed

.clang-format-ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
jbmc/src/miniz/miniz.cpp
2+
src/cprover/wcwidth.c
23
src/nonstd/optional.hpp
34
unit/catch/catch.hpp

regression/cprover/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
default: tests.log
2+
3+
include ../../src/config.inc
4+
include ../../src/common
5+
6+
test:
7+
@../test.pl -e -p -c '../../../src/cprover/cprover'
8+
9+
tests.log:
10+
@../test.pl -e -p -c '../../../src/cprover/cprover'
11+
12+
clean:
13+
$(RM) tests.log

regression/cprover/arrays/array1.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
int array[10];
2+
3+
int main()
4+
{
5+
array[1l] = 10;
6+
array[2l] = 20;
7+
__CPROVER_assert(array[1l] == 10, "property 1"); // passes
8+
__CPROVER_assert(array[2l] == 20, "property 2"); // passes
9+
__CPROVER_assert(array[2l] == 30, "property 3"); // fails
10+
}

regression/cprover/arrays/array1.desc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
array1.c
3+
--text --solve
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\(\d+\) ∀ ς : state \. S20\(ς\) ⇒ S21\(ς\[element_address\(❝array❞, 1\):=10\]\)$
7+
^\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ S22\(ς\[element_address\(❝array❞, 2\):=20\]\)$
8+
^\(\d+\) ∀ ς : state \. S22\(ς\) ⇒ \(ς\(element_address\(❝array❞, 1\)\) = 10\)$
9+
^\(\d+\) ∀ ς : state \. S23\(ς\) ⇒ \(ς\(element_address\(❝array❞, 2\)\) = 20\)$
10+
^\(\d+\) ∀ ς : state \. S24\(ς\) ⇒ \(ς\(element_address\(❝array❞, 2\)\) = 30\)$
11+
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
12+
^\[main\.assertion\.2\] line \d+ property 2: SUCCESS$
13+
^\[main\.assertion\.3\] line \d+ property 3: REFUTED$
14+
--

regression/cprover/arrays/array2.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int main()
2+
{
3+
int array[10];
4+
int i, j, k;
5+
__CPROVER_assume(i == j);
6+
__CPROVER_assert(array[i] == array[j], "property 1"); // passes
7+
__CPROVER_assert(array[i] == array[k], "property 2"); // fails
8+
}

regression/cprover/arrays/array2.desc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
array2.c
3+
--text --solve
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\(\d+\) ∀ ς : state \. \(S23\(ς\) ∧ ς\(❝main::1::i❞\) = ς\(❝main::1::j❞\)\) ⇒ S24\(ς\)$
7+
^\(\d+\) ∀ ς : state \. S24\(ς\) ⇒ \(ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::i❞\), signedbv\[64\]\)\)\) = ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::j❞\), signedbv\[64\]\)\)\)\)$
8+
^\(\d+\) ∀ ς : state \. S25\(ς\) ⇒ \(ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::i❞\), signedbv\[64\]\)\)\) = ς\(element_address\(❝main::1::array❞, cast\(ς\(❝main::1::k❞\), signedbv\[64\]\)\)\)\)$
9+
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
10+
^\[main\.assertion\.2\] line \d+ property 2: REFUTED$
11+
--

regression/cprover/arrays/array4.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
int main()
2+
{
3+
int a[100];
4+
int *p = a;
5+
__CPROVER_assert(p[23] == a[23], "property 1"); // should pass
6+
return 0;
7+
}

regression/cprover/arrays/array4.desc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
array4.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
7+
--
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
int array[10];
2+
3+
int main()
4+
{
5+
for(__CPROVER_size_t i = 0; i < sizeof(array) / sizeof(int); i++)
6+
array[i] = 0;
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
iterate_over_array1.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main\.array_bounds\.1\] line \d+ array bounds in array\[.*i\]: SUCCESS$
7+
--
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#define size_t __CPROVER_size_t
2+
#define false 0
3+
#define true 1
4+
5+
_Bool find_zero(const void *const array, const size_t array_len)
6+
{
7+
const unsigned char *array_bytes = array;
8+
9+
// iterate over array
10+
for(size_t i = 0; i < array_len; ++i)
11+
// clang-format off
12+
__CPROVER_loop_invariant(i >= 0 && i <= array_len)
13+
__CPROVER_loop_invariant(__CPROVER_POINTER_OFFSET(array_bytes) == 0)
14+
__CPROVER_loop_invariant(__CPROVER_r_ok(array_bytes, array_len))
15+
// clang-format on
16+
{
17+
if(array_bytes[i] == 0)
18+
{
19+
return true;
20+
}
21+
}
22+
23+
return false;
24+
}
25+
26+
int main()
27+
{
28+
unsigned char array[10];
29+
size_t array_len = 10;
30+
find_zero(array, array_len);
31+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
iterate_over_array2.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[find_zero\.pointer\.1\] line \d+ pointer safe: SUCCESS$
7+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
KNOWNBUG
2+
aws_array_eq_c_str_contract.c
3+
-I aws-c-common/include aws-c-common/source/byte_buf.c
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Function: aws_array_eq_c_str
2+
// Source: aws-c-common/source/byte_buf.c
3+
4+
#include <aws/common/byte_buf.h>
5+
6+
// bool aws_array_eq_c_str(const void *const array, const size_t array_len, const char *const c_str)
7+
8+
int main()
9+
{
10+
const void *array;
11+
size_t array_len;
12+
const char *c_str;
13+
14+
__CPROVER_assume(__CPROVER_r_ok(array, array_len));
15+
__CPROVER_assume(__CPROVER_is_cstring(c_str));
16+
17+
aws_array_eq_c_str(array, array_len, c_str);
18+
19+
return 0;
20+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
KNOWNBUG
2+
aws_array_eq_c_str_ignore_case_contract.c
3+
--safety aws-c-common/source/byte_buf.c -I aws-c-common/include
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Function: aws_array_eq_c_str_ignore_case
2+
// Source: aws-c-common/source/byte_buf.c
3+
4+
#include <aws/common/byte_buf.h>
5+
6+
// bool aws_array_eq_c_str_ignore_case(const void *const array, const size_t array_len, const char *const c_str)
7+
8+
int main()
9+
{
10+
const void *array;
11+
size_t array_len;
12+
const char *c_str;
13+
14+
__CPROVER_assume(__CPROVER_r_ok(array, array_len));
15+
__CPROVER_assume(__CPROVER_is_cstring(c_str));
16+
17+
aws_array_eq_c_str_ignore_case(array, array_len, c_str);
18+
19+
return 0;
20+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
KNOWNBUG
2+
aws_array_eq_ignore_case_contract.c
3+
--safety aws-c-common/source/byte_buf.c -I aws-c-common/include
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Function: aws_array_eq_ignore_case
2+
// Source: aws-c-common/source/byte_buf.c
3+
4+
#include <aws/common/byte_buf.h>
5+
6+
// bool aws_array_eq_ignore_case(
7+
// const void *const array_a,
8+
// const size_t len_a,
9+
// const void *const array_b,
10+
// const size_t len_b)
11+
12+
int main()
13+
{
14+
const void *array_a, *array_b;
15+
size_t len_a, len_b;
16+
17+
__CPROVER_assume(__CPROVER_r_ok(array_a, len_a));
18+
__CPROVER_assume(__CPROVER_r_ok(array_b, len_b));
19+
20+
aws_array_eq_ignore_case(array_a, len_a, array_b, len_b);
21+
22+
return 0;
23+
}

regression/cprover/aws-c-common/setup

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
git clone https://github.com/awslabs/aws-c-common -b v0.6.13
4+
5+
echo "/* nothing */" > aws-c-common/include/aws/common/config.h
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
aws_array_list_mem_swap_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: aws_array_list_mem_swap
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
aws_byte_buf_append_with_lookup_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: aws_byte_buf_append_with_lookup
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
aws_hash_array_ignore_case_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: aws_hash_array_ignore_case
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
aws_hash_table_clear_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: aws_hash_table_clear
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
aws_hash_table_eq_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: aws_hash_table_eq
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
aws_hash_table_foreach_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: aws_hash_table_foreach
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
hashlittle2_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: hashlittle2
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
memcpy_using_uint64_impl_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: memcpy_using_uint64_impl
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
memset_override_0_impl_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: memset_override_0_impl
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
memset_using_uint64_impl_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: memset_using_uint64_impl
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
s_find_entry1_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: s_find_entry1
2+
3+
int main()
4+
{
5+
return 0;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
s_get_next_element_contract.c
3+
--safety
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Function: s_get_next_element
2+
3+
int main()
4+
{
5+
return 0;
6+
}

0 commit comments

Comments
 (0)