File tree 3 files changed +23
-0
lines changed
regression/cbmc/Array_operations3
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(
183
183
// obtain the actual array(s)
184
184
process_array_expr (state, array_expr);
185
185
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
+
186
191
// prepare to build the array_of
187
192
exprt value = clean_expr (code.op1 (), state, false );
188
193
You can’t perform that action at this time.
0 commit comments