File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
regression/cbmc/Array_operations3 Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ int main ()
2+ {
3+ void * p ;
4+ __CPROVER_array_set (p , 0 );
5+ __CPROVER_assert (
6+ * (char * )p == 0 , "should fail: array_set had no effect on invalid object" );
7+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+
4+ ^\[main.assertion.1\] line 5 should fail: array_set had no effect on invalid object: FAILURE$
5+ ^VERIFICATION FAILED$
6+ ^EXIT=10$
7+ ^SIGNAL=0$
8+ --
9+ ^warning: ignoring
10+ --
11+ An array_set on an invalid pointer must not result in an invariant failure.
Original file line number Diff line number Diff line change @@ -183,6 +183,11 @@ void goto_symext::symex_other(
183183 // obtain the actual array(s)
184184 process_array_expr (state, array_expr);
185185
186+ // if we dereferenced a void pointer, we may get a zero-sized (failed)
187+ // object -- nothing to be assigned
188+ if (array_expr.type ().id () == ID_empty)
189+ return ;
190+
186191 // prepare to build the array_of
187192 exprt value = clean_expr (code.op1 (), state, false );
188193
You can’t perform that action at this time.
0 commit comments