Skip to content

use assert-false instead of nondet for missing functions - #535

Merged
danielsn merged 2 commits into
model-checking:mainfrom
danielsn:nondet_missing
Oct 15, 2021
Merged

danielsn merged 2 commits into
model-checking:mainfrom
danielsn:nondet_missing

Conversation

@danielsn

@danielsn danielsn commented Oct 1, 2021 •

Copy link
Copy Markdown
Contributor

Description of changes:

Currently, CBMC does nondet for missing functions, which may be unsound if they have side-effects. Instead, soundly assert false.

Resolved issues:

Partially addresses #303

Call-outs:

Testing:

  • How is this change tested? Existing regression suite, plus new expect_fail test

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

@danielsn
danielsn marked this pull request as draft October 1, 2021 20:40

@zhassan-aws zhassan-aws 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.

Can you clarify the impact of this change? Will it cause verification to fail if the program includes a missing function that is reachable? If so, can you add a comment explaining this?

@celinval

celinval commented Oct 1, 2021

Copy link
Copy Markdown
Contributor

This is a tough one. I almost feel like this should be an option to how a user runs rmc or even a proof-harness.

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.

Can we do this without extern "C"? How common is a construct like this in user code?

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'd love to do this in pure rust. But I can't easily tell how to generate that case. Thoughts?

@nmanthey

nmanthey commented Oct 4, 2021

Copy link
Copy Markdown
Contributor

This is used in CBMC when we run verification of larger projects where we cut off calls to functions, but do not want execution to stop. Essentially, this is part of aggressive slicing - and yes, it's known to be unsound.

@danielsn
danielsn marked this pull request as ready for review October 15, 2021 16:18
@nchong-at-aws

Copy link
Copy Markdown
Contributor

@nmanthey to clarify: when you say "it's known to be unsound" you mean aggressive slicing rather than replacing a function body with assert(false), right?

@danielsn
danielsn merged commit 27af99c into model-checking:main Oct 15, 2021
@danielsn
danielsn deleted the nondet_missing branch October 15, 2021 16:47
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 26, 2022
…ing#535)

* use assert-false instead of nondet for missing functions

* Add a flag to disable the missing function checks, and use it for tests which require it
tedinski pushed a commit that referenced this pull request Apr 27, 2022
* use assert-false instead of nondet for missing functions

* Add a flag to disable the missing function checks, and use it for tests which require it
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.

5 participants