Skip to content

Commit a65e583

Browse files
committed
gcc prompts: verify the premise of incomplete-fix findings
The GCC profile repeatedly reports that a fix is narrower than the IPA function summary without checking that the analysis actually proves the claimed shape dead. On PR129112 that produced one false positive per round for loop-header defaults and -fstrict-enums enumerations, although the unpatched compiler does not fail for them. Add a false-positive-guide rule and extend the mirror-the-analysis rule in review-core.md: report an incomplete-fix claim only when the other analysis actually proves the shape dead, otherwise there is no failure for the patch to leave reachable. Closes: #979 Signed-off-by: Sendao Yan <yansendao@126.com>
1 parent f143da4 commit a65e583

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎projects/gcc/prompts/false-positive-guide.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Before validating a finding, check these GCC-specific invariants and conventions
1616
4. **DejaGnu Testsuite Files (`gcc/testsuite/*`, `libstdc++-v3/testsuite/*`)**:
1717
- Never report undefined behavior, uninitialized variables, infinite loops, or syntax errors inside `testsuite/` files. Those files are compiler test inputs.
1818

19+
5. **Verify the premise of an "incomplete fix" claim**:
20+
- Before reporting that a fix is narrower than another analysis (IPA function summary, VRP, jump threading) and leaves the original failure reachable, name the exact condition that analysis uses and show that it keeps the reported failure reachable for the claimed shape. For example, an IPA function-summary claim can mean the predicate is proven false and the call edge is redirected so the callee is removed while the failing IR survives; different IPA consumers act differently, so name the specific condition rather than assuming one mechanism.
21+
- If you cannot establish that, it is not a finding. A partial fix is a finding only when the original failure is demonstrably still reachable.
22+
1923
## 2. Invalid Dismissals (Real Bugs You Must NOT Dismiss)
2024

2125
1. **Never Dismiss `wide_int` Precision Mismatches**:

‎projects/gcc/prompts/review-core.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ Before accepting a new guard, early bailout, or in-pass deletion, enumerate the
2929
## IR Teardown and Complemented Analysis
3030

3131
1. **Teardown order is part of the contract**: When a pass deletes IR, compare the order with the canonical implementations (`remove_bb ()`, `remove_dead_stmt ()`): outgoing edges and their PHI arguments first, then statements (backwards, with `unlink_stmt_vdef`), then the block's own PHI nodes, then re-insert the terminator. Flag any deviation, and check the reverse order too: releasing a PHI result before the statements that use it, or a statement result before successor PHI arguments are removed, corrupts SSA.
32-
2. **Mirror the analysis you are complementing**: When a patch adds a predicate meant to match another pass (IPA function summary, VRP, threader), read that analysis and enumerate the exact condition it uses. If the new condition is narrower, the original failure remains reachable for the excluded shapes (other index ranges, loop-header default blocks, enums, the sibling pass instances). Report that as a finding — a partial fix that leaves the reported bug reachable is not "no issue".
32+
2. **Mirror the analysis you are complementing**: When a patch adds a predicate meant to match another pass (IPA function summary, VRP, threader), read that analysis and enumerate the exact condition it uses. If the new condition is narrower, do not assume the original failure remains reachable: show that the condition keeps the reported failure reachable for the claimed shape (for example, an IPA predicate proven false with the call edge redirected so the callee is removed while the failing IR survives). Report the shape as still broken only when that premise holds.

0 commit comments

Comments
 (0)