Skip to content

Use assert args in an unreachable block to prevent spurious warnings and to check for errors#1561

Merged
tedinski merged 2 commits intomodel-checking:mainfrom
zhassan-aws:fix-assert
Aug 21, 2022
Merged

Use assert args in an unreachable block to prevent spurious warnings and to check for errors#1561
tedinski merged 2 commits intomodel-checking:mainfrom
zhassan-aws:fix-assert

Conversation

@zhassan-aws
Copy link
Contributor

Description of changes:

Currently, Kani's overridden assert macros ignores the arguments. This may lead to not reporting errors in their usage (#803) or to report spurious unused variable warnings (#1556). This PR updates Kani's implementation of the macros to emit a dummy, unreachable block inside which the arguments are processed so that errors are captured, without affecting verification performance.

Resolved issues:

Resolves #803
Resolves #1556

Call-outs:

Testing:

  • How is this change tested? Added two tests

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

@zhassan-aws zhassan-aws requested a review from a team as a code owner August 20, 2022 01:55
@tedinski tedinski merged commit efdb0b2 into model-checking:main Aug 21, 2022
@zhassan-aws zhassan-aws deleted the fix-assert branch August 22, 2022 19:01
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.

Spurious unused variable warnings for variables used in asserts Kani's assert macro implementation bypasses some compile-time checks

2 participants