Repository navigation
DFCC: simplify the scope resolution that #9164 introduced - #9553
Open
tautschnig wants to merge 1 commit into
Open
tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
The bug fixed by diffblue#9164 arose because get_write_set resolved the scope of an instruction through skipped (contract-less) loops, while get_tracked_set and get_local_set used the raw loop id. diffblue#9164 fixed this by copying the same five lines of scope resolution into all three methods, and the constructor's top-level DECL collection performs the same resolution once more. Factor this out into a private get_scope_id method, so that all users agree on the scope of an instruction by construction and cannot drift apart again. diffblue#9164 also made gen_dfcc_loop_info keep the locals of skipped inner loops in the local set of the enclosing loop. This has no effect: check_inner_loops_have_contracts rejects contract-less loops nested in loops with contracts, so the enclosing loop is skipped as well, and get_local_set and get_tracked_set resolve through skipped loops and never consult a skipped loop's sets. The locals of all skipped loops end up in top_level_local instead. The comment introduced with that special case suggested that assignments to such locals would otherwise be checked against the enclosing loop's write set, which cannot happen, and the special case contradicted the documentation of dfcc_loop_infot::local ("excluding identifiers declared in nested loops"). Remove it and explain why skipped loops need no treatment there. No change in behaviour. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
tautschnig
requested review from
feliperodri,
kroening,
peterschrammel and
remi-delmas-3000
as code owners
November 23, 2026 11:43
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9553 +/- ##
========================================
Coverage 81.28% 81.28%
========================================
Files 1725 1725
Lines 191618 191611 -7
Branches 73 73
========================================
Hits 155751 155751
+ Misses 35867 35860 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug fixed by #9164 arose because get_write_set resolved the scope of an instruction through skipped (contract-less) loops, while get_tracked_set and get_local_set used the raw loop id. #9164 fixed this by copying the same five lines of scope resolution into all three methods, and the constructor's top-level DECL collection performs the same resolution once more. Factor this out into a private get_scope_id method, so that all users agree on the scope of an instruction by construction and cannot drift apart again.
#9164 also made gen_dfcc_loop_info keep the locals of skipped inner loops in the local set of the enclosing loop. This has no effect: check_inner_loops_have_contracts rejects contract-less loops nested in loops with contracts, so the enclosing loop is skipped as well, and get_local_set and get_tracked_set resolve through skipped loops and never consult a skipped loop's sets. The locals of all skipped loops end up in top_level_local instead. The comment introduced with that special case suggested that assignments to such locals would otherwise be checked against the enclosing loop's write set, which cannot happen, and the special case contradicted the documentation of dfcc_loop_infot::local ("excluding identifiers declared in nested loops"). Remove it and explain why skipped loops need no treatment there.
No change in behaviour.