Commit 1e25c00
committed
Fix variable initialization order in snapshot-harness aliasing pointers
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.
Co-authored-by: Kiro autonomous agent
Fixes: #49781 parent 76dd20f commit 1e25c00
File tree
3 files changed
+3
-5
lines changed- regression/snapshot-harness
- dynamic-array-int-ordering
- dynamic-array-int
- src/goto-harness
3 files changed
+3
-5
lines changedLines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
| |||
339 | 342 | | |
340 | 343 | | |
341 | 344 | | |
342 | | - | |
343 | 345 | | |
344 | | - | |
345 | | - | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| |||
0 commit comments