https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109514

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:9964df74a9e99e850bf9b0b6ff5c47133f846db8

commit r13-7190-g9964df74a9e99e850bf9b0b6ff5c47133f846db8
Author: Jason Merrill <ja...@redhat.com>
Date:   Fri Apr 14 13:37:16 2023 -0400

    -Wdangling-pointer: fix MEM_REF handling [PR109514]

    Here we hit the MEM_REF case, with its arg an ADDR_EXPR, but had no
handling
    for that and wrongly assumed it would be a reference to a local variable.
    This patch overhauls the logic for deciding whether the target is something
    to warn about so that we only warn if we specifically recognize the target
    as non-local.  None of the existing tests regress as a result.

            PR c++/109514

    gcc/ChangeLog:

            * gimple-ssa-warn-access.cc (pass_waccess::check_dangling_stores):
            Overhaul lhs_ref.ref analysis.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wdangling-pointer-6.C: New test.

Reply via email to