-
Notifications
You must be signed in to change notification settings - Fork 63
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
Pointer cast #1564
Pointer cast #1564
Conversation
This produces a new setup value that points to the same location, but is assumed to point to values of the provided type. This is useful when, e.g., verifing code that contains `union` values inside structs, as the type provided by the bitcode will not accurately reflect all the intended uses. It may also be useful for other "polymorphic" C programming styles.
It is only used in the LLVM mode, and I'd like to make some changes. It is unclear that having this be shared code is worthwhile.
This check is necessarily approximate, and the system may miss incompatible resolved values if overlapping regions are resolved through different pointer casts. This should not be a soundness issue, as the verification will fail at a later point instead (albeit, with less-useful information provided to the user).
This plays more nicely with `llvm_field`, as alias information is retained longer.
…re function, similar to `llvm_field`, `llvm_elem`, etc.
4dca5af
to
cda04b1
Compare
I plan to add a unit test, but I think this is otherwise ready to go. |
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.
LGTM, aside from some documentation-related requests.
The new form still needs to be piped through the Python client.
I'm not sure I have the necessary context to pipe the new pointer cast form through the Python client code. |
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'm not sure I have the necessary context to pipe the new pointer cast form through the Python client code.
I've opened #1575 to track this.
This PR implements a new
llvm_cast_pointer
operation for setup blocks. It allows the user to specify that a pointer should be treated as a pointer to a given llvm type, despite the information contained in its initial allocation site.This is primarily intended to make it easier to work with unions, as the type information provided by the LLVM bitcode in these cases is not terribly useful.