Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions doc/cprover-manual/memory-primitives.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ number of bytes:
- `_Bool __CPROVER_w_ok(const void *p, size_t size)`

At present, both primitives are equivalent as all memory in CBMC is considered
both readable and writeable. If `p` is the null pointer, the primitives return
false. If `p` is valid, the primitives return true if the memory segment
starting at the pointer has at least the given size, and false otherwise. If `p`
is neither null nor valid, the semantics is unspecified. It is valid to apply
the primitive to pointers that point to within a memory object. For example:
both readable and writeable. The primitives return true if `p` points to a live
object and the object that `p` points into extends to at least `size` more
bytes. Else, an assertion encompassing the primitive will be reported to fail.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it also returns false if p is NULL.

Is there a reason why we don't want to say that this would return a non-deterministic value otherwise?

Do not use these primitives in assumptions when `p` can be not valid as such use
can yield spurious verification results.

```C
char *p = malloc(10);
Expand Down
Loading