Skip to content

Commit 117f553

Browse files
author
Thomas Kiley
committed
Add a test for an array we can initalize
Here the array contains pointers, so we can sensibly create a non-null array here.
1 parent ff1f4b0 commit 117f553

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

regression/goto-harness/void-star-pointer/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ void test_void_array(void *input_array[10])
1212
assert(input_array[0] == 0);
1313
assert(false);
1414
}
15+
16+
void test_ptr_array(void **input_array)
17+
{
18+
__CPROVER_assume(input_array != 0);
19+
assert(input_array[0] == 0);
20+
assert(false);
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
main.c
3+
--harness-type call-function --function test_ptr_array --treat-pointer-as-array input_array
4+
\[test_ptr_array\.assertion\.1\] line \d+ assertion input_array\[0\] == 0: SUCCESS
5+
\[test_ptr_array\.assertion\.2\] line \d+ assertion false: FAILURE
6+
^VERIFICATION FAILED$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
Ensure the harness is able to initalize an array of void* pointers where
12+
the array is non-null, but the elements are null, if the void** is treated as an
13+
array.

0 commit comments

Comments
 (0)