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

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #2)
...
Actually, scratch that, sorry.  Richard is right that the false positive is due
to a bug in the warning code.  The following patch resolves it:

diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc
index 04aa849a4b1..79093b46906 100644
--- a/gcc/gimple-ssa-warn-access.cc
+++ b/gcc/gimple-ssa-warn-access.cc
@@ -4467,6 +4467,7 @@ pass_waccess::gimple_call_return_arg_ref (gcall *call)
     {
       access_ref aref;
       if (m_ptr_qry.get_ref (arg, call, &aref, 0)
+         && aref.deref < 0
          && DECL_P (aref.ref))
        return aref.ref;
     }

Reply via email to