public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102555] New: missing -Waddress comparing &p[0] to zero
@ 2021-10-01 16:06 msebor at gcc dot gnu.org
2024-03-11 12:30 ` [Bug c/102555] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-01 16:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102555
Bug ID: 102555
Summary: missing -Waddress comparing &p[0] to zero
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
Event with the patch for pr102103 applied, only the first of the two equality
expressions gets a warning, even though ideally both should. This is tracked
(and xfailed) in gcc/testsuite/c-c++-common/Waddress-4.c.
$ cat z.c && gcc -S -Wall -fdump-tree-original=/dev/stdout z.c
int f (int *p, int i)
{
return &p[i] == 0;
}
int g (int *p)
{
return &p[0] == 0;
}
z.c: In function ‘f’:
z.c:3:16: warning: the comparison will always evaluate as ‘false’ for the
pointer operand in ‘p + (sizetype)((long unsigned int)i * 4)’ must not be NULL
[-Waddress]
3 | return &p[i] == 0;
| ^~
;; Function f (null)
;; enabled by -tree-original
{
return p + (sizetype) ((long unsigned int) i * 4) == 0B;
}
;; Function g (null)
;; enabled by -tree-original
{
return p == 0B;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/102555] missing -Waddress comparing &p[0] to zero
2021-10-01 16:06 [Bug c/102555] New: missing -Waddress comparing &p[0] to zero msebor at gcc dot gnu.org
@ 2024-03-11 12:30 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-11 12:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102555
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-03-11
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-11 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 16:06 [Bug c/102555] New: missing -Waddress comparing &p[0] to zero msebor at gcc dot gnu.org
2024-03-11 12:30 ` [Bug c/102555] " pinskia at gcc dot gnu.org
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).