Skip to content
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

Upgrade to CBMC 5.69.1 (with fixes) #1811

Merged
merged 15 commits into from
Nov 1, 2022

Conversation

adpaco-aws
Copy link
Contributor

@adpaco-aws adpaco-aws commented Oct 27, 2022

Description of changes:

NOTE: This PR initially upgraded CBMC to v5.68.0, but it was actually upgraded to v5.69.1 as part of the review process. Unfortunately, the commit was added without first editing the title.

Upgrades CBMC to v5.69.1 and changes Kani so that it conforms with the latest changes in CBMC:

Resolved issues:

Resolves #1779

Testing:

  • How is this change tested? Existing egression.

  • 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.

@adpaco-aws adpaco-aws requested a review from a team as a code owner October 27, 2022 21:05
cprover_bindings/src/goto_program/typ.rs Outdated Show resolved Hide resolved
@@ -286,6 +289,7 @@ impl Type {
CInteger(CIntType::Bool) => Some(mm.bool_width),
CInteger(CIntType::Char) => Some(mm.char_width),
CInteger(CIntType::Int) => Some(mm.int_width),
Integer => Some(mm.int_width),
Copy link
Member

Choose a reason for hiding this comment

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

This one is unbounded, it doesn’t have a bitwidth.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, do you think we should return None or just Some(x) where x is a large number?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can have an "infinite" token? But Some(x) is semantically wrong for all x

@@ -58,7 +65,7 @@ pub fn machine_model_symbols(mm: &MachineModel) -> Vec<Symbol> {
),
int_constant("__CPROVER_architecture_wchar_t_width", mm.wchar_t_width),
int_constant("__CPROVER_architecture_word_size", mm.word_size),
int_constant("__CPROVER_rounding_mode", mm.rounding_mode),
int_constant_c_int("__CPROVER_rounding_mode", mm.rounding_mode),
Copy link
Contributor

Choose a reason for hiding this comment

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

Seriously? There is one remaining outlier? Is there an issue open to CBMC about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't find one, so I opened diffblue/cbmc#7282 (and pasted the issue there)

Copy link
Member

Choose a reason for hiding this comment

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

I'll comment on the CBMC issue, but indeed rounding mode is different.

cprover_bindings/src/goto_program/typ.rs Outdated Show resolved Hide resolved
cprover_bindings/src/goto_program/typ.rs Outdated Show resolved Hide resolved
// But for some reason, not pushing it causes a CBMC invariant violation
// since version 5.68.0.
// <https://github.com/model-checking/kani/issues/1810>
args.push("--slice-formula".into());
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mess with concrete playback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs more investigation.

My understanding was that using --slice-formula with concrete playback may remove calls to kani::any() from the trace, which doesn't allow us to provide a counter-example (in that case, we just report a test couldn't be generated). But all tests we have for concrete playback and --visualize pass if we use --slice-formula.

Comment on lines 11 to 13
// Note: the Kani compiler changes `void` return types to the empty tuple `()`
// AKA `VoidUnit`. Because of that, we need to declare its type `struct Unit`
// and the extern instance `VoidUnit` here.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is an accurate description. Rust () is not the same thing as void, and __rust_dealloc is extern Rust not extern C https://stdrs.dev/nightly/x86_64-unknown-linux-gnu/src/alloc/alloc.rs.html#37

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I've changed it to the same comment we use in the Kani compiler's typ.rs module:

/// Mapping unit to `void` works for functions with no return type but not for
/// variables with type unit. We treat both uniformly by declaring an empty
/// struct type: `struct Unit {}` and a global variable `struct Unit VoidUnit`
/// returned by all void functions (both declared by the Kani compiler).

@tautschnig
Copy link
Member

High-level note: you might consider upgrading to 5.69.1 right away, which will be out later on today (diffblue/cbmc#7283).

@adpaco-aws adpaco-aws changed the title Upgrade to CBMC 5.68.0 (with fixes) Upgrade to CBMC 5.69.1 (with fixes) Oct 28, 2022
@adpaco-aws
Copy link
Contributor Author

High-level note: you might consider upgrading to 5.69.1 right away, which will be out later on today (diffblue/cbmc#7283).

Tried now, but brew couldn't find it in CI. I'm rolling back to v5.68.0 for now.

@adpaco-aws adpaco-aws changed the title Upgrade to CBMC 5.69.1 (with fixes) Upgrade to CBMC 5.68.0 (with fixes) Oct 28, 2022
@tautschnig
Copy link
Member

High-level note: you might consider upgrading to 5.69.1 right away, which will be out later on today (diffblue/cbmc#7283).

Tried now, but brew couldn't find it in CI. I'm rolling back to v5.68.0 for now.

Please retry, should just be a matter of timing.

@@ -48,7 +55,11 @@ struct Foo2 {

uint32_t S = 12;

void update_static() { S++; }
struct Unit update_static()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is something that ought to work once C-FFI is in place. We should have comments and a tracking ticket explaining that this is a workaround we want to remove

@adpaco-aws adpaco-aws merged commit 3007e84 into model-checking:main Nov 1, 2022
adpaco-aws added a commit that referenced this pull request Nov 1, 2022
@adpaco-aws adpaco-aws changed the title Upgrade to CBMC 5.68.0 (with fixes) Upgrade to CBMC 5.69.1 (with fixes) Nov 1, 2022
@adpaco-aws adpaco-aws self-assigned this Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Updating to latest CBMC version requires update to architecture strings
3 participants