Fix variable initialization order in snapshot-harness aliasing pointers#8798
Open
tautschnig wants to merge 1 commit intodiffblue:developfrom
Open
Fix variable initialization order in snapshot-harness aliasing pointers#8798tautschnig wants to merge 1 commit intodiffblue:developfrom
tautschnig wants to merge 1 commit intodiffblue:developfrom
Conversation
1e25c00 to
f154c3e
Compare
The root cause was in the topological sort implementation. The dfs() method enforced that seen and inserted sets must be empty on entry (via PRECONDITION) and would clear them on exit. However, topological_sort() calls dfs() multiple times in a loop for each item in the input collection. This meant only the first item was sorted correctly; subsequent items would fail the precondition or produce incorrect results. The fix moves the set clearing logic to the beginning of topological_sort(), ensuring a fresh DFS traversal for the entire collection while allowing the DFS to maintain state across recursive calls within a single item's dependency graph. The regression test descriptors are updated to use flexible property numbering (\d+ instead of hardcoded 27) since the corrected initialization order changes the numbering of pointer dereference checks. Co-authored-by: Kiro (autonomous agent) <kiro-agent@users.noreply.github.com> Fixes: diffblue#4978
f154c3e to
9a3d481
Compare
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the memory-snapshot harness symbol ordering traversal and re-enables two snapshot-harness regression tests as CORE by making their output matching less brittle.
Changes:
- Reset
preorderttraversal state once persort()call (instead of perdfs()invocation) to ensure a fresh, consistent traversal across the full input. - Promote snapshot-harness regression tests from
KNOWNBUGtoCORE. - Relax regression output matching for pointer dereference IDs from a fixed number to
\d+, and remove outdated known-bug commentary blocks.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/goto-harness/memory_snapshot_harness_generator.h |
Clears seen/inserted at the start of preordert::sort() to ensure traversal state is reset once per sort. |
regression/snapshot-harness/dynamic-array-int/test.desc |
Marks test as CORE and makes pointer-dereference property ID matching robust to numbering changes. |
regression/snapshot-harness/dynamic-array-int-ordering/test.desc |
Same as above for the ordering-focused variant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 root cause was in the topological sort implementation. The
dfs()method enforced that seen and inserted sets must be empty on entry (viaPRECONDITION) and would clear them on exit. However,topological_sort()callsdfs()multiple times in a loop for each item in the input collection. This meant only the first item was sorted correctly; subsequent items would fail the precondition or produce incorrect results.The fix moves the set clearing logic to the beginning of
topological_sort(), ensuring a fresh DFS traversal for the entire collection while allowing the DFS to maintain state across recursive calls within a single item's dependency graph.Co-authored-by: Kiro autonomous agent
Fixes: #4978