Skip to content

DFCC: unwind the inclusion check of an assigns clause to its size - #9577

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:kiro/dfcc-inclusion-unwind
Open

tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:kiro/dfcc-inclusion-unwind

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

DFCC unwinds the loops of its library that run over a write set as far as the largest assigns clause (dfcc_libraryt::specialize), but not the loop of __CPROVER_contracts_write_set_check_assigns_clause_inclusion. That function checks that an assigns clause is included in the write set of the code around it: a loop's clause (of a loop in a function that a loop calls), or the clause of a contract that replaces a call. --unwind then bounds this loop, and with fewer unwindings than the clause has targets its unwinding assertion fails: a correct program gives VERIFICATION FAILED at --unwind 2 with 7 targets.

The loop is now unwound like the others. The largest assigns clause also counts those of the contracts that replace calls (and of function pointer contracts), as the check of their inclusion in the caller's write set runs over their targets.

Tests: loop_contracts_inclusion_unwind (a loop's clause of 7 targets, in a function that a loop calls) and replace_contract_inclusion_unwind (a replacing contract's clause of 6 targets, larger than the clause of the contract being checked) fail before and pass now. contracts, contracts-dfcc (both modes), goto-instrument and cbmc CORE pass.

Not covered: __CPROVER_contracts_write_set_check_frees_clause_inclusion loops over the candidate's frees clause in the same way, and --unwind still bounds it; unwinding it would need the largest frees clause, which DFCC does not compute yet.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

DFCC unwinds the loops of its library that run over a write set as far
as the largest assigns clause, but not the one of
__CPROVER_contracts_write_set_check_assigns_clause_inclusion, which
checks that an assigns clause is included in the write set of the code
around it: a loop's (of a loop in a function that a loop calls), or a
contract's that replaces a call. --unwind then bounded it, and with
fewer unwindings than the clause has targets, its unwinding assertion
failed (VERIFICATION FAILED for a correct program at --unwind 2 with 7
targets). The largest assigns clause now counts those of the contracts
that replace calls too, as the check of their inclusion in the caller's
runs over their targets.

Tests: loop_contracts_inclusion_unwind (a loop's clause of 7 targets, in
a function that a loop calls) and replace_contract_inclusion_unwind (a
replacing contract's clause of 6 targets, larger than the checked
contract's) fail before and pass now.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.29%. Comparing base (4853dbe) to head (89603a6).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9577      +/-   ##
===========================================
- Coverage    81.29%   81.29%   -0.01%     
===========================================
  Files         1725     1725              
  Lines       191655   191674      +19     
  Branches        73       73              
===========================================
+ Hits        155809   155824      +15     
- Misses       35846    35850       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@feliperodri feliperodri added the Code Contracts Function and loop contracts label Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Contracts Function and loop contracts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants