Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions regression/cbmc-incr-smt2/arrays/address_of_two_array_sizes.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
int main()
{
int example_array1[10000];
char example_array2[20000];
void *foo;
__CPROVER_bool choice = nondet___CPROVER_bool();
if(choice)
foo = example_array1;
else
foo = example_array2;
__CPROVER_assert(
foo != example_array1 || __CPROVER_OBJECT_SIZE(foo) == 40000,
"Array condition 1");
__CPROVER_assert(__CPROVER_OBJECT_SIZE(foo) == 40000, "Array condition 2");
__CPROVER_assert(
foo != example_array2 || __CPROVER_OBJECT_SIZE(foo) == 20000,
"Array condition 3");
__CPROVER_assert(__CPROVER_OBJECT_SIZE(foo) == 20000, "Array condition 4");
}
17 changes: 17 additions & 0 deletions regression/cbmc-incr-smt2/arrays/address_of_two_array_sizes.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CORE
address_of_two_array_sizes.c
--verbosity 10
Passing problem to incremental SMT2 solving
address_of\(main\:\:1\:\:example_array1\!0\@1\[0\]\)
address_of\(main\:\:1\:\:example_array2\!0\@1\[0\]\)
line \d+ Array condition 1: SUCCESS
line \d+ Array condition 2: FAILURE
line \d+ Array condition 3: SUCCESS
line \d+ Array condition 4: FAILURE
^EXIT=10$
^SIGNAL=0$
--
--
Test that __CPROVER_OBJECT_SIZE returns the expected results in the case where
the pointer passed to it may point to one of 2 arrays, where each array has a
different size.
15 changes: 10 additions & 5 deletions regression/cbmc-incr-smt2/arrays/array_address_of.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
int main()
{
int example_array[10000];
__CPROVER_assert(
__CPROVER_OBJECT_SIZE(example_array) == 40000, "Array condition 1");
__CPROVER_assert(
__CPROVER_OBJECT_SIZE(example_array) == 40001, "Array condition 2");
int example_array1[10000];
int example_array2[10000];
int *foo;
int choice;
if(choice)
foo = example_array1;
else
foo = example_array2;
__CPROVER_assert(__CPROVER_OBJECT_SIZE(foo) == 40000, "Array condition 1");
__CPROVER_assert(__CPROVER_OBJECT_SIZE(foo) == 40001, "Array condition 2");
}
4 changes: 3 additions & 1 deletion regression/cbmc-incr-smt2/arrays/array_address_of.desc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
CORE
array_address_of.c

--verbosity 10
Passing problem to incremental SMT2 solving
address_of\(main\:\:1\:\:example_array1\!0\@1\[0\]\)
address_of\(main\:\:1\:\:example_array2\!0\@1\[0\]\)
line \d+ Array condition 1: SUCCESS
line \d+ Array condition 2: FAILURE
^EXIT=10$
Expand Down