Repository navigation
Conversation
4 tasks done
Three defects let the analysis call a queue single-producer or single-consumer when it is not, and substituting on such a verdict introduces a race: - A thread id was handed out per static spawn site, so a worker pool started in a loop counted as one producer. A site now counts as possibly many threads when it sits in a loop or a CFG cycle, or in a function that may itself run more than once. - main had no thread, so its pushes and pops, and those of everything it calls, were dropped. It now has one. - A parameter was resolved by taking argument zero of the call, whatever the parameter's position, so a function taking two queues merged them. Each instance of a function now records its call site and binds each parameter to the argument at its own position. Two precision problems go with them. Resolution followed only the first instance on a thread, so a helper called with two queues reached one; it now follows every instance. Thread contexts were computed by recursion over a cache seeded with empty placeholders, so mutual recursion left some functions with none, depending on visiting order; they are now computed to a fixed point. Indirect calls are still not followed, but no longer invisible. A function whose address is used other than as a spawn's entry, or that nothing in the module calls, runs on an "unknown" thread, and every queue it touches is UNKNOWN. An access that resolves to no queue at all makes every verdict UNKNOWN, since it may touch any of them. A spawn's entry is the first argument that is a function's address, not operand zero, which is the hidden result slot where the target returns std::thread indirectly. Output follows IR order, and analyses are marked preserved. Verified: 22 of 22 pass, no warnings. The eight new or rewritten defect tests fail against dev, each for the reason it names. The prototype's example, compiled from C++ for AArch64 and for x86-64, gives the known answer on both: SPSC for q1, MPMC for q2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ZweZeya
force-pushed
the
fix/analysis-soundness
branch
from
October 18, 2026 05:20
30eca14 to
25d430f
Compare
Collaborator
|
Closing as superseded by #10. The three soundness defects this closes (a spawn in a loop counted as one thread, |
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.
Stacked on #2 (
fix/lift-lower-crashes).What this changes
Closes the three soundness defects in
docs/audit.md, each of which could make a queue look single-producer or single-consumer when it is not:mainhad no thread, so its accesses were dropped. It has one now.Also two precision fixes: resolution follows every instance on a thread, not just the first; thread contexts are computed to a fixed point instead of recursion over a cache seeded with empty placeholders.
Indirect calls are still not followed, but no longer invisible: a function whose address escapes, or that nothing calls, runs on an "unknown" thread, and every queue it touches is UNKNOWN. A spawn's entry is the first function-address argument, not operand zero (the sret slot on x86-64). Output follows IR order.
How it was checked
23 of 23 pass, no warnings. The eight new or rewritten defect tests fail against the parent, each for the reason it names (worker pool called SPSC;
main's push dropped, SPMC instead of MPMC;b's context lost under mutual recursion; second parameter's queue attributed to the first). The prototype's example, compiled for AArch64 and x86-64, gives SPSC forq1and MPMC forq2on both.Checklist
🤖 Generated with Claude Code