-
Notifications
You must be signed in to change notification settings - Fork 105
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
Fix vtable size check for never #422
Fix vtable size check for never #422
Conversation
let check = Expr::eq(Expr::object_size(temp_var.address_of()), vt_size.clone()); | ||
let assert_msg = format!("Correct CBMC vtable size for {:?}", operand_type.kind()); | ||
let cbmc_size = if ty.clone().is_empty() { | ||
// CBMC errors on passing a pointer to void to __CPROVER_OBJECT_SIZE, so just pass 0 |
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.
Are we guaranteed this is correct? Or is this a temporary hack?
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 an assert for the Never
case and a link showing that we do know the size is 0. This way, will get a more detailed error if this fails again for a different type.
Description of changes:
With some combinations of traits and the Never type, the CBMC-time sanity check assert fails because you cannot take an object size of void.
Breaking this into its own PR to land since it's coming up outside of drop work.
Resolved issues:
Resolves #421
Call-outs:
Working on getting a small example now, but a little difficulty since this happens in external crate code.
Testing:
Existing tests, working on minimal example.
No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.