Go: fix FP in go/dead-store-of-local - #22610
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused query change correctly addresses the false positive and includes regression coverage.
Review effort: Balanced (auto)
Findings: None
Note
Copilot is running an experiment and ran this review at Balanced.
What changed in this PR
Updates the Go dead-store query to ignore references that exist only in unreachable code.
Changes:
- Uses reachable IR instructions to detect variable usage.
- Adds a short-circuit regression test.
- Updates shifted test expectations.
| File | Description |
|---|---|
go/ql/src/RedundantCode/DeadStoreOfLocal.ql |
Checks variable usage through reachable IR. |
go/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/main.go |
Adds the regression case. |
go/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/CONSISTENCY/UnexpectedFrontendErrors.expected |
Updates the shifted source location. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
aschackmull
approved these changes
Sep 18, 2026
Contributor
Author
|
DCA results look good. This gets rid of one FP in DCA and doesn't affect performance significantly. |
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.
Follow-up to #22182. Some FPs were added where a read of a local was not noticed because it was trimmed from the CFG because it was unreachable. This restores the previous behaviour.