@@ -211,6 +211,57 @@ returns true when it is safe to do both. These predicates can be given an
211
211
optional size; when the size argument is not given, the size of the subtype
212
212
(which must not be ** void** ) of the pointer type is used.
213
213
214
+ #### \_\_ CPROVER\_ havoc\_ object
215
+
216
+
217
+ This function requires a valid pointer and updates ** all bytes** of the
218
+ underlying object with nondeterministic values.
219
+
220
+ ``` C
221
+ void __CPROVER_havoc_object (void * p);
222
+ ```
223
+
224
+ **Warning**
225
+
226
+ This primitive havocs object bytes before
227
+ the given `p` and after `p + sizeof(*p)`:
228
+
229
+ ```C
230
+ struct foo {
231
+ int x;
232
+ int y;
233
+ int z;
234
+ };
235
+
236
+ struct foo thefoo = {.x = 1; .y = 2, .z = 3};
237
+
238
+ int* p = &thefoo.y; // pointing to thefoo.y
239
+
240
+ __CPROVER_havoc_object(p); // makes the whole struct nondet
241
+ __CPROVER_assert(thefoo.x == 1, "fails because `thefoo.x` is now nondet");
242
+ __CPROVER_assert(thefoo.y == 2, "fails because `thefoo.y` is now nondet");
243
+ __CPROVER_assert(thefoo.z == 3, "fails because `thefoo.z` is now nondet");
244
+ ```
245
+
246
+ #### \_\_ CPROVER\_ havoc\_ slice
247
+
248
+ This function requires requires that ` __CPROVER_w_ok(p, size) ` holds,
249
+ and updates ` size ` consecutive bytes of the underlying object, starting at ` p ` ,
250
+ with nondeterministic values.
251
+
252
+ ``` C
253
+ void __CPROVER_havoc_slice (void * p, __ CPROVER_size_t size);
254
+ ```
255
+
256
+ **Caveat**
257
+
258
+ - If the slice contains bytes that can be interpreted as pointers by the
259
+ program, this will cause these pointers to become invalid
260
+ (i.e. they will not point to anything meaningful).
261
+ - If this slice only contains bytes that are not interpreted as pointers
262
+ by the program, then havocing the slice is equivalent to making the
263
+ interpretation of these bytes nondeterministic.
264
+
214
265
### Predefined Types and Symbols
215
266
216
267
#### \_\_CPROVER\_bitvector
0 commit comments