Skip to content

Conversation

@avanhatt
Copy link
Contributor

@avanhatt avanhatt commented Aug 12, 2021

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:

  • How is this change tested?

Existing tests, working on minimal example.

  • Is this a refactor change?

No.

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@danielsn danielsn merged commit e997f75 into model-checking:main-154-2021-08-06 Aug 12, 2021
adpaco-aws pushed a commit that referenced this pull request Aug 17, 2021
adpaco-aws pushed a commit that referenced this pull request Aug 24, 2021
@avanhatt avanhatt deleted the never-size branch September 14, 2021 15:23
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 26, 2022
tedinski pushed a commit that referenced this pull request Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed assertion: Correct CBMC vtable size for Never

2 participants