Skip to content

CONTRACTS: add __CPROVER_obeys_contract predicate #7355

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

Merged

Conversation

remi-delmas-3000
Copy link
Collaborator

Depends on #7348 (first commit).

Adds a new predicate __CPROVER_obeys_contract(function_pointer, contract).

Allows to specify that a function pointer satisfies a given contract in requires and ensures
clauses of another contract.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

Base: 78.35% // Head: 78.34% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (c821f5e) compared to base (c7550b6).
Patch coverage: 86.46% of modified lines in pull request are covered.

❗ Current head c821f5e differs from pull request most recent head 272ebf0. Consider uploading reports for the commit 272ebf0 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7355      +/-   ##
===========================================
- Coverage    78.35%   78.34%   -0.02%     
===========================================
  Files         1645     1646       +1     
  Lines       190182   190121      -61     
===========================================
- Hits        149015   148945      -70     
- Misses       41167    41176       +9     
Impacted Files Coverage Δ
src/ansi-c/ansi_c_convert_type.cpp 80.42% <ø> (ø)
src/ansi-c/ansi_c_convert_type.h 100.00% <ø> (ø)
src/ansi-c/c_expr.h 100.00% <ø> (ø)
src/ansi-c/c_typecheck_base.cpp 83.09% <ø> (ø)
src/ansi-c/c_typecheck_base.h 100.00% <ø> (ø)
src/ansi-c/c_typecheck_code.cpp 80.17% <ø> (ø)
src/ansi-c/parser.y 80.89% <ø> (ø)
src/ansi-c/scanner.l 63.39% <ø> (ø)
src/goto-instrument/contracts/contracts.h 100.00% <ø> (ø)
...contracts/dynamic-frames/dfcc_contract_functions.h 100.00% <ø> (ø)
... and 380 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tautschnig
Copy link
Collaborator

I'll review once #7348 is merged and a possible bug that @remi-delmas-3000 and I just discussed out-of-band has been addressed.

@remi-delmas-3000 remi-delmas-3000 force-pushed the obeys-contract-predicate branch 3 times, most recently from 50a54f4 to 71db674 Compare November 23, 2022 20:12
This predicate can be used in requires and ensures
clauses to express that a function pointer satisfies
a given contract.
The predicate is implemented in cprover_contracts.c
and turns into an assignment in assumption contexts
and to an equality check in assertions contexts.
The dfcc_instrumentt methods were updated to report
any occurrence of the predicate discovered when
instrumenting GOTO functions.
@remi-delmas-3000 remi-delmas-3000 merged commit 742f4ce into diffblue:develop Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users aws-high Code Contracts Function and loop contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants