Skip to content

Commit fb5e2dd

Browse files
committed
state encoding
1 parent 0eb2cb3 commit fb5e2dd

File tree

364 files changed

+8869
-26
lines changed

Some content is hidden

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

364 files changed

+8869
-26
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: 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+
--safety -I aws-c-common/include aws-c-common/source/byte_buf.c
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Function: aws_array_eq_c_str
2+
3+
#include <aws/common/byte_buf.h>
4+
5+
// bool aws_array_eq_c_str_ignore_case(const void *const array, const size_t array_len, const char *const c_str)
6+
7+
int main()
8+
{
9+
const void *array;
10+
size_t array_len;
11+
const char *c_str;
12+
13+
__CPROVER_assume(__CPROVER_r_ok(array, array_len));
14+
__CPROVER_assume(__CPROVER_is_cstring(c_str));
15+
16+
aws_array_eq_c_str_ignore_case(array, array_len, c_str);
17+
18+
return 0;
19+
}

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_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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Function: aws_array_eq_c_str_ignore_case
2+
// Source: aws-c-common/source/byte_buf.c
3+
4+
int main()
5+
{
6+
return 0;
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
aws_array_eq_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_array_eq_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_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+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
s_sift_down_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_sift_down
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_sift_up_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_sift_up
2+
3+
int main()
4+
{
5+
return 0;
6+
}

regression/cprover/basic/assume1.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 x;
4+
5+
__CPROVER_assume(x >= 10);
6+
__CPROVER_assert(x >= 5, "property 1"); // should pass
7+
__CPROVER_assert(x >= 15, "property 2"); // should fail
8+
}

regression/cprover/basic/assume1.desc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
assume1.c
3+
--text --solve
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^ \(\d+\) ∀ ς : state \. true ⇒ SInitial\(ς\)$
7+
^ \(\d+\) S0 = SInitial$
8+
^ \(\d+\) S1 = S0$
9+
^\(\d+\) ∀ ς : state \. \(S20\(ς\) ∧ ς\(❝main::1::x❞\) ≥ 10\) ⇒ S21\(ς\)$
10+
^\(\d+\) ∀ ς : state \. S21\(ς\) ⇒ \(ς\(❝main::1::x❞\) ≥ 5\)$
11+
^\(\d+\) ∀ ς : state \. S22\(ς\) ⇒ \(ς\(❝main::1::x❞\) ≥ 15\)$
12+
^\(\d+\) ∀ ς : state \. S24\(ς\) ⇒ S25\(ς\[❝return'❞:=nondet::S25\]\)$
13+
^\[main\.assertion\.1\] line \d+ property 1: SUCCESS$
14+
^\[main\.assertion\.2\] line \d+ property 2: REFUTED$
15+
--

regression/cprover/basic/basic1.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int x;
2+
3+
int main()
4+
{
5+
x = 1;
6+
__CPROVER_assert(x == 1, "property 1");
7+
return 0;
8+
}

0 commit comments

Comments
 (0)