-
Notifications
You must be signed in to change notification settings - Fork 277
Add documentation for memory primitives #5333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good to go.
My only preference would be to pick either cbmc
or CBMC
and stick with it for all references to it for consistency's sake.
variable would correspond to an object of size 4, and memory allocated via | ||
`malloc(10)` would correspond to an object of size 10. | ||
|
||
A pointer then consists of two parts: the upper n bits form the object ID, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be changed to n
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the n doesn't refer to code or commandline text or something like that so I think it shouldn't be highlighted that way.
9f4cac8
to
ff21d95
Compare
\page memory-primitives Memory Primitives | ||
|
||
This document describes the semantics and usage of memory-related and | ||
pointer-related primitives in cbmc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pointer-related primitives in cbmc. | |
pointer-related primitives in CBMC. |
# Background | ||
|
||
|
||
## Memory and pointers in cbmc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Memory and pointers in cbmc | |
## Memory and Pointers in CBMC |
## Memory and pointers in cbmc | ||
|
||
When cbmc analyzes a program, by default it uses the architectural parameters of | ||
the platform it is running on. That is, on a 64-bit system, cbmc will treat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the platform it is running on. That is, on a 64-bit system, cbmc will treat | |
the platform it is running on. That is, on a 64-bit system, CBMC will treat |
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
integer values, and then constrained to negative values via the assumption. | ||
In cbmc, like uninitialized integers, uninitialized pointers are treated as | ||
having a nondeterministic value. That is, the value of the pointer itself is | ||
nondeterministically chosen, though **no memory is allocated**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe say that you are going to describe what can be expected from an intitialized pointer below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a sentence saying that pointers should be explicitely initialized
allocated memory, or is out of bounds of the memory object it points to (i.e., | ||
the memory object identified by `__CPROVER_POINTER_OBJECT(p)`). | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe say upfront that some operations, particularly on invalid pointers, are unspecified. Say how I can detect that I have something with unspecified semantics in my harness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ff21d95
to
62a4b55
Compare
Uh oh!
There was an error while loading. Please reload this page.