From: Martin Sebor <msebor@gmail.com>
To: Jason Merrill <jason@redhat.com>,
"Joseph S. Myers" <joseph@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: PING [PATCH] restore ancient -Waddress for weak symbols [PR33925]
Date: Sun, 7 Nov 2021 16:31:29 -0700 [thread overview]
Message-ID: <963ef517-3556-cd5c-e756-53df72f0a541@gmail.com> (raw)
In-Reply-To: <24cd9565-b127-6534-d98e-7482b3dc082f@gmail.com>
Ping:
https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582415.html
On 10/23/21 5:06 PM, Martin Sebor wrote:
> On 10/4/21 3:37 PM, Jason Merrill wrote:
>> On 10/4/21 14:42, Martin Sebor wrote:
>>> While resolving the recent -Waddress enhancement request (PR
>>> PR102103) I came across a 2007 problem report about GCC 4 having
>>> stopped warning for using the address of inline functions in
>>> equality comparisons with null. With inline functions being
>>> commonplace in C++ this seems like an important use case for
>>> the warning.
>>>
>>> The change that resulted in suppressing the warning in these
>>> cases was introduced inadvertently in a fix for PR 22252.
>>>
>>> To restore the warning, the attached patch enhances
>>> the decl_with_nonnull_addr_p() function to return true also for
>>> weak symbols for which a definition has been provided.
>>
>> I think you probably want to merge this function with
>> fold-const.c:maybe_nonzero_address, which already handles more cases.
>
> maybe_nonzero_address() doesn't behave quite like
> decl_with_nonnull_addr_p() expects and I'm reluctant to muck
> around with the former too much since it's used for codegen,
> while the latter just for warnings. (There is even a case
> where the functions don't behave the same, and would result
> in different warnings between C and C++ without some extra
> help.)
>
> So in the attached revision I just have maybe_nonzero_address()
> call decl_with_nonnull_addr_p() and then refine the failing
> (or uncertain) cases separately, with some overlap between
> them.
>
> Since I worked on this someone complained that some instances
> of the warning newly enhanced under PR102103 aren't suppresed
> in code resulting from macro expansion. Since it's trivial,
> I include the fix for that report in this patch as well.
>
> Tested on x86_64-linux.
>
> Martin
next prev parent reply other threads:[~2021-11-07 23:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 18:42 Martin Sebor
2021-10-04 21:37 ` Jason Merrill
2021-10-23 23:06 ` Martin Sebor
2021-11-07 23:31 ` Martin Sebor [this message]
2021-11-15 16:50 ` PING 2 " Martin Sebor
2021-11-16 20:23 ` Jason Merrill
2021-11-17 1:11 ` Martin Sebor
2021-11-17 18:31 ` Jason Merrill
2021-11-17 19:21 ` Martin Sebor
2021-11-18 1:27 ` Martin Sebor
2021-11-18 15:58 ` Jason Merrill
2021-10-04 22:39 ` Eric Gallager
2021-11-02 18:51 ` Martin Sebor
2021-11-02 19:28 ` Marek Polacek
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=963ef517-3556-cd5c-e756-53df72f0a541@gmail.com \
--to=msebor@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.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).