From: Jason Merrill <jason@redhat.com>
To: Jeff Law <jeffreyalaw@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH RFA] -Wdangling-pointer: fix MEM_REF handling [PR109514]
Date: Fri, 14 Apr 2023 21:54:08 -0400 [thread overview]
Message-ID: <dd18a106-62da-65c0-4af0-4e13a9a4c853@redhat.com> (raw)
In-Reply-To: <032ca48b-6e8c-f469-ab28-37933ea0ecf5@gmail.com>
On 4/14/23 21:22, Jeff Law wrote:
>
>
> On 4/14/23 17:42, Jason Merrill via Gcc-patches wrote:
>> Tested x86_64-pc-linux-gnu, ok for trunk?
>>
>> -- 8< --
>>
>> 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.
> One might ask if we have a (MEM_REF (ADDR_REF ...)) why we didn't
> simplify that by removing the MEM_REF and ADDR_REF wrappers.
FYI in this case the type of the MEM_REF is the type of a member of a
member of a member of the variable.
> But on
> the assumption there's a good reason to have such nodes, OK for the trunk.
>
> jeff
>
prev parent reply other threads:[~2023-04-15 1:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 23:42 Jason Merrill
2023-04-15 1:22 ` Jeff Law
2023-04-15 1:54 ` Jason Merrill [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd18a106-62da-65c0-4af0-4e13a9a4c853@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).