Skip to content

Add "fixme" testcase for #1208 - #1210

Merged
adpaco merged 3 commits into
model-checking:mainfrom
celinval:issue-1208-test
May 25, 2022
Merged

adpaco merged 3 commits into
model-checking:mainfrom
celinval:issue-1208-test

Conversation

@celinval

Copy link
Copy Markdown
Contributor

Description of changes:

Our checks currently don't abort the execution flow. This adds a test case for it.

I also added an override for the unreachable!() macro to print nicer error message.

Resolved issues:

N/A

Call-outs:

Since this issue is related to how we handle a check failure, I couldn't use the fixme regression. So I added the test to the expected regression.

Testing:

  • How is this change tested?

  • Is this a refactor change?

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.

I also added an override for the `unreachable!()` macro to print nicer
error message.
@celinval
celinval requested a review from a team as a code owner May 20, 2022 18:02

@adpaco adpaco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add unreachable to the overrides section in our documentation.

Comment thread library/std/src/lib.rs
#[macro_export]
macro_rules! unreachable {
($($arg:tt)*) => ({
panic!(concat!("internal error: entered unreachable code: ",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How does this compare to the std version?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The message is basically the same except for the following:

  • we still inclue ":" in the no arguments case.
  • the std one use format
  • we print extra quotes for the message

// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Check that code after an overflow check failure is unreachable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps change the comment to say: should be unreachable, and add a link to #1208?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed!


//! Check that code after an overflow check failure is unreachable.

#[cfg_attr(kani, kani::proof)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this to allow us to run it with rustc? (Neat!)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but I can remove it. I use that a lot when comparing the two but sometimes I forget to remove them.

@adpaco
adpaco merged commit b193f18 into model-checking:main May 25, 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.

3 participants