Skip to content

Add warning for unsupported constructs - #1095

Merged
danielsn merged 9 commits into
model-checking:mainfrom
celinval:issue-922
Apr 25, 2022
Merged

danielsn merged 9 commits into
model-checking:mainfrom
celinval:issue-922

Conversation

@celinval

@celinval celinval commented Apr 22, 2022 •

Copy link
Copy Markdown
Contributor

Description of changes:

For now, at the end of each compilation unit, we will print one single warning if we found any unsupported construct. This warning will list the name and number of occurrences of each unsupported constructs that was found.

Output example:

warning: Compilation unit included the following unsupported constructs:
             - 'arith_offset' intrinsic (4)
             - 'copy' intrinsic (3)

Resolved issues:

Resolves #922

Call-outs:

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.

For now, at the end of each compilation unit, we will print one single
warning if we found any unsupported construct.

This warning will list the name and number of occurrences of each
unsupported constructs that was found.
@celinval
celinval requested a review from a team as a code owner April 22, 2022 20:51
/// If it is not used, we the assertion will pass.
/// This allows us to continue to make progress parsing rust code, while remaining sound (thanks to the `assert(false)`)
///
/// TODO: https://github.com/model-checking/kani/issues/8 assume the required validity constraints for the nondet return

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.

These two issues have been closed already. Removing the TODO.

@zhassan-aws

Copy link
Copy Markdown
Contributor

LGTM. Thanks! Can we add a sentence at the end of the message to clarify what the impact of this warning is, e.g.

warning: Compilation unit included the following unsupported constructs:
             - 'arith_offset' intrinsic (4)
             - 'copy' intrinsic (3)
             Verification will fail if one or more of those constructs is reachable from the harness

@celinval

Copy link
Copy Markdown
Contributor Author

Sure

@danielsn danielsn 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.

Not necessarily for this PR, but we should probably also post these warnings in the Cbmc-viewer report

debug!("codegen_unimplemented: {} at {}", operation_name, loc.short_string());
let key: InternedString = operation_name.into();
if !self.unsupported_constructs.contains_key(&key) {
self.unsupported_constructs.insert(key.clone(), Vec::new());

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.

I think the clone is not needed, because InternedString is Copy

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.

k

.map(|(key, val)| (key.map(|s| String::from(s)), val))
.collect();
let mut msg =
String::from("Compilation unit included the following unsupported constructs:\n");

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 "Compilation unit" familiar terminology to our users?

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.

I changed the message. Let me know what you think.

@danielsn
danielsn merged commit f822a94 into model-checking:main Apr 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.

Kani compiler should give a warning when user code includes code that we cannot handle

3 participants