On 2026-01-06 20:09, Siddhesh Poyarekar wrote:
On 2026-01-06 20:03, Andrew Pinski wrote:
On Tue, Jan 6, 2026 at 11:11 AM Siddhesh Poyarekar <[email protected]> wrote:

The second pass of warn_access (waccess2) was added to implement
dangling pointer checks but it implicitly ran the early checks too,
which issues false warnings on code that has not been fully optimized.

Limit this second run to only dangling pointer checks for call
statements.  This does not break any of the existing warning tests, so
it didn't seem to add any actual value for the additional run anyway.

gcc/ChangeLog:

         PR tree-optimization/123374
         * gimple-ssa-warn-access.cc (pass_waccess::set_pass_param): Add
         a second parameter.
         (pass_waccess::check_call): Skip access checks for waccess2.
         (pass_waccess::execute): Drop initialization of
         M_CHECK_DANGLING_P.
         * passes.def: Adjust.

gcc/testsuite/ChangeLog:

         PR tree-optimization/123374
         * g++.dg/warn/pr123374.cc: New test.

Ok but your testcase is misnamed because of the `.cc` suffix. The only
file name ending that works in the g++.dg testsuite is `.C`.


Ack, I'll rename and push then.

Sorry, spoke too soon, I just noticed I didn't have any dg-* directives in the test case :facepalm:

I'll fix and repost.

Sid

Reply via email to