@@ -20,33 +20,6 @@ to the program. If the expression evaluates to false, the execution
20
20
aborts without failure. More detail on the use of assumptions is in the
21
21
section on [Assumptions](../modeling/assumptions/).
22
22
23
- #### \_\_CPROVER\_r_ok, \_\_CPROVER\_w_ok
24
-
25
- ```C
26
- void __CPROVER_r_ok(const void *, size_t size);
27
- void __CPROVER_w_ok(const void *, size_t size);
28
- ```
29
-
30
- The function ** \_\_ CPROVER\_ r_ok** returns true if reading the piece of
31
- memory starting at the given pointer with the given size is safe.
32
- ** \_\_ CPROVER\_ w_ok** does the same with writing.
33
-
34
- #### \_\_ CPROVER\_ same\_ object, \_\_ CPROVER\_ POINTER\_ OBJECT, \_\_ CPROVER\_ POINTER\_ OFFSET, \_\_ CPROVER\_ DYNAMIC\_ OBJECT
35
-
36
- ``` C
37
- _Bool __CPROVER_same_object (const void * , const void * );
38
- __ CPROVER_size_t __ CPROVER_POINTER_OBJECT(const void * p);
39
- __ CPROVER_ssize_t __ CPROVER_POINTER_OFFSET(const void * p);
40
- _ Bool __ CPROVER_DYNAMIC_OBJECT(const void * p);
41
- ```
42
-
43
- The function **\_\_CPROVER\_same\_object** returns true if the two
44
- pointers given as arguments point to the same object. The function
45
- **\_\_CPROVER\_POINTER\_OFFSET** returns the offset of the given pointer
46
- relative to the base address of the object. The function
47
- **\_\_CPROVER\_DYNAMIC\_OBJECT** returns true if the pointer passed as
48
- arguments points to a dynamically allocated object.
49
-
50
23
#### \_\_CPROVER\_input, \_\_CPROVER\_output
51
24
52
25
```C
@@ -156,6 +129,47 @@ the array **dest** with the given value.
156
129
157
130
Uninterpreted functions are documented [here](./modeling-nondeterminism.md)).
158
131
132
+ ### Memory-Related Functions
133
+
134
+ The semantics of the primitives listed in this section is described in more detail in the
135
+ document about [Memory Primitives](http://cprover.diffblue.com/memory-primitives.html).
136
+
137
+ #### \_\_CPROVER\_POINTER\_OBJECT, \_\_CPROVER\_POINTER\_OFFSET, \_\_CPROVER\_same\_object
138
+
139
+ ```C
140
+ __CPROVER_size_t __CPROVER_POINTER_OBJECT(const void *p);
141
+ __CPROVER_ssize_t __CPROVER_POINTER_OFFSET(const void *p);
142
+ _Bool __CPROVER_same_object(const void *p, const void *q);
143
+ ```
144
+
145
+ The function ** \_\_ CPROVER\_ POINTER\_ OBJECT** returns the ID of the object the
146
+ pointer points to. The function ** \_\_ CPROVER\_ POINTER\_ OFFSET** returns the
147
+ offset of the given pointer relative to the base address of the object. The
148
+ function ** \_\_ CPROVER\_ same\_ object** returns true if the two pointers given as
149
+ arguments point to the same object.
150
+
151
+ #### \_\_ CPROVER\_ OBJECT\_ SIZE, \_\_ CPROVER\_ DYNAMIC\_ OBJECT, \_\_ CPROVER\_ r\_ ok, \_\_ CPROVER\_ w\_ ok
152
+
153
+ The following primitives require a pointer that is null or valid in order to
154
+ have well-defined semantics in all usage cases. See the document about
155
+ [ Memory Primitives] ( http://cprover.diffblue.com/memory-primitives.html )
156
+ for more details. It also includes a description of the ` --pointer-primitive-check `
157
+ option to verify the preconditions of the primitives.
158
+
159
+ ``` C
160
+ __CPROVER_size_t __CPROVER_OBJECT_SIZE (const void * p);
161
+ _ Bool __ CPROVER_DYNAMIC_OBJECT(const void * p);
162
+ void __ CPROVER_r_ok(const void * p, size_t size);
163
+ void __ CPROVER_w_ok(const void * p, size_t size);
164
+ ```
165
+
166
+ The function **\_\_CPROVER_\_OBJECT\_SIZE** returns the size of the object the
167
+ given pointer points to. The function **\_\_CPROVER\_DYNAMIC\_OBJECT** returns
168
+ true if the pointer passed as an argument points to a dynamically allocated
169
+ object. The function **\_\_CPROVER\_r_ok** returns true if reading the piece of
170
+ memory starting at the given pointer with the given size is safe.
171
+ **\_\_CPROVER\_w_ok** does the same with writing.
172
+
159
173
### Predefined Types and Symbols
160
174
161
175
#### \_\_CPROVER\_bitvector
0 commit comments