@@ -18,25 +18,44 @@ value(s) therein are not modified.
18
18
The following functions can be used in assigns clause to specify ranges of
19
19
assignable addresses.
20
20
21
+ Given an lvalue expression `expr` with a complete type `expr_t`,
22
+ `__CPROVER_typed_target(expr)` specifies that the range
23
+ of `sizeof(expr_t)` bytes starting at `&expr` is assignable:
24
+ ```c
25
+ __CPROVER_assignable_t __CPROVER_typed_target(expr_t expr);
26
+ ```
27
+
28
+ Given a pointer ` ptr ` pointing into some object ` o ` ,
29
+ ` __CPROVER_whole_object(ptr) ` specifies that all bytes of the object ` o `
30
+ are assignable:
31
+ ``` c
32
+ __CPROVER_assignable_t __CPROVER_whole_object (void * ptr);
33
+ ```
34
+
21
35
Given a pointer `ptr` pointing into some object `o`, `__CPROVER_object_from(ptr)`
22
- specifies that all bytes starting from the given pointer and until the end of
23
- the object are assignable:
36
+ specifies that the range of bytes starting from the pointer and until the end of
37
+ the object `o` are assignable:
24
38
```c
25
- __CPROVER_size_t __CPROVER_object_from(void *ptr);
39
+ __CPROVER_assignable_t __CPROVER_object_from(void *ptr);
26
40
```
27
41
28
- Given a pointer ` ptr ` pointing into some object ` o ` , ` __CPROVER_object_from(ptr, size) `
29
- specifies that ` size ` bytes starting from the given pointer and until the end of the object are assignable.
30
- The ` size ` value must such that ` size <= __CPROVER_object_size(ptr) - __CPROVER_pointer_offset(ptr) ` holds:
42
+ Given a pointer ` ptr ` pointing into some object ` o ` , ` __CPROVER_object_upto(ptr, size) `
43
+ specifies that the range of ` size ` bytes of ` o ` starting at ` ptr ` are assignable:
44
+ The ` size ` value must such that the range does not exceed the object boundary,
45
+ that is, ` __CPROVER_object_size(ptr) - __CPROVER_pointer_offset(ptr) >= size ` must hold:
31
46
32
47
``` c
33
- __CPROVER_size_t __CPROVER_object_slice (void * ptr, __ CPROVER_size_t size);
48
+ __CPROVER_assignable_t __CPROVER_object_upto (void * ptr, __ CPROVER_size_t size);
34
49
```
35
50
36
- Caveats and limitations: The slices in question must *not*
37
- be interpreted as pointers by the program. During call-by-contract replacement,
38
- `__CPROVER_havoc_slice(ptr, size)` is used to havoc these targets,
39
- and `__CPROVER_havoc_slice` does not support havocing pointers.
51
+ CAVEAT: The ranges specified by `__CPROVER_whole_object`,
52
+ `__CPROVER_object_from` and `__CPROVER_object_upto` must *not*
53
+ be interpreted as pointers by the program. This is because during
54
+ call-by-contract replacement, `__CPROVER_havoc_slice(ptr, size)` is used to
55
+ havoc these byte ranges, and `__CPROVER_havoc_slice` does not support
56
+ havocing pointers. `__CPROVER_typed_target` must be used to specify targets
57
+ that are pointers.
58
+
40
59
### Parameters
41
60
42
61
An _assigns_ clause currently supports simple variable types and their pointers,
0 commit comments