On 9/30/21 1:35 PM, Joseph Myers wrote:
On Thu, 30 Sep 2021, Martin Sebor via Gcc-patches wrote:
Jason, since you approved the C++ changes, would you mind looking
over the C bits and if they look good to you giving me the green
light to commit the patch?
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579693.html
The C changes are OK, with two instances of "for the address %qE will
never be NULL" fixed to refer to the address *of* %qE as elsewhere (those
are for IMAGPART_EXPR and REALPART_EXPR; C++ also has one "the address %qE
will never be NULL"), and the "pr??????" in the tests filled in with an
actual PR number for the XFAILed cases.
Thanks for the careful review and the approval!
I remember having a reason for dropping the "of" in the two instances
in the C FE but after double-checking the output I see you're right
that it should be there. Good catch!
I believe the C++ instance is correct. It's issued for the address
of a member, as in the former of the two below:
struct S { int i; };
bool f ()
{
return &S::i == 0; // the address ‘&S::i’
}
bool g (S *p)
{
return &p->i == 0; // the address of ‘S::i’
}
z.c: In function ‘bool f()’:
z.c:5:16: warning: the address ‘&S::i’ will never be NULL [-Waddress]
5 | return &S::i == 0;
| ~~~~~~^~~~
z.c: In function ‘bool g(S*)’:
z.c:10:16: warning: the address of ‘S::i’ will never be NULL [-Waddress]
10 | return &p->i == 0;
| ~~~~~~^~~~
z.c:1:16: note: ‘S::i’ declared here
1 | struct S { int i; };
| ^
I've beefed up the tests to verify the expected wording.
Thanks also for prompting me to open bugs for the xfailed tests,
something I tend to forget to do when it depends on the patch I'm
developing. I've raised pr102555 for the C FE folding defeating
the warning. The C++ bug that tracks the xfails in the C++ tests
is pr102378.
I've pushed the updated patch in r12-4059 after retesting the whole
thing on x86_64-linux.
Martin