public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65452] New: strcmp (foo, foo) could give a warning
@ 2015-03-17 14:33 rstrode at redhat dot com
2015-03-17 14:36 ` [Bug c/65452] " dmalcolm at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: rstrode at redhat dot com @ 2015-03-17 14:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452
Bug ID: 65452
Summary: strcmp (foo, foo) could give a warning
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: rstrode at redhat dot com
Created attachment 35043
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35043&action=edit
example that could warn
sometimes gcc will give a warning like:
warning: the address of 'foo' will always evaluate as 'true'
if the address foo is used in a conditional expression.
It would be useful if there was also a warning of the form:
warning: the comparison of 'foo' with itself will always evaluate as 'true'
if the code does "if (strcmp (foo, foo) == 0)" or similar.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/65452] strcmp (foo, foo) could give a warning
2015-03-17 14:33 [Bug c/65452] New: strcmp (foo, foo) could give a warning rstrode at redhat dot com
@ 2015-03-17 14:36 ` dmalcolm at gcc dot gnu.org
2015-03-17 14:41 ` dmalcolm at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-03-17 14:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dmalcolm at gcc dot gnu.org
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Some context from our IRC chat, for other gcc devs:
I just wrote:
if (strcmp (foo, foo) == 0)
instead of
if (strcmp (self->priv->foo, foo) == 0)
in a patch... thankfully got noticed in review.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/65452] strcmp (foo, foo) could give a warning
2015-03-17 14:33 [Bug c/65452] New: strcmp (foo, foo) could give a warning rstrode at redhat dot com
2015-03-17 14:36 ` [Bug c/65452] " dmalcolm at gcc dot gnu.org
@ 2015-03-17 14:41 ` dmalcolm at gcc dot gnu.org
2015-03-17 15:21 ` rstrode at redhat dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-03-17 14:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/65452] strcmp (foo, foo) could give a warning
2015-03-17 14:33 [Bug c/65452] New: strcmp (foo, foo) could give a warning rstrode at redhat dot com
2015-03-17 14:36 ` [Bug c/65452] " dmalcolm at gcc dot gnu.org
2015-03-17 14:41 ` dmalcolm at gcc dot gnu.org
@ 2015-03-17 15:21 ` rstrode at redhat dot com
2015-03-25 8:48 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rstrode at redhat dot com @ 2015-03-17 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452
--- Comment #2 from Ray Strode <rstrode at redhat dot com> ---
probably should catch
if (foo == foo) {
}
type situations too.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/65452] strcmp (foo, foo) could give a warning
2015-03-17 14:33 [Bug c/65452] New: strcmp (foo, foo) could give a warning rstrode at redhat dot com
` (2 preceding siblings ...)
2015-03-17 15:21 ` rstrode at redhat dot com
@ 2015-03-25 8:48 ` mpolacek at gcc dot gnu.org
2015-03-25 8:53 ` mpolacek at gcc dot gnu.org
2015-08-12 11:02 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-25 8:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-03-25
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/65452] strcmp (foo, foo) could give a warning
2015-03-17 14:33 [Bug c/65452] New: strcmp (foo, foo) could give a warning rstrode at redhat dot com
` (3 preceding siblings ...)
2015-03-25 8:48 ` mpolacek at gcc dot gnu.org
@ 2015-03-25 8:53 ` mpolacek at gcc dot gnu.org
2015-08-12 11:02 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-25 8:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Target Milestone|--- |6.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/65452] strcmp (foo, foo) could give a warning
2015-03-17 14:33 [Bug c/65452] New: strcmp (foo, foo) could give a warning rstrode at redhat dot com
` (4 preceding siblings ...)
2015-03-25 8:53 ` mpolacek at gcc dot gnu.org
@ 2015-08-12 11:02 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-08-12 11:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65452
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We now warn for the testcase in Comment 2.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-08-12 11:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 14:33 [Bug c/65452] New: strcmp (foo, foo) could give a warning rstrode at redhat dot com
2015-03-17 14:36 ` [Bug c/65452] " dmalcolm at gcc dot gnu.org
2015-03-17 14:41 ` dmalcolm at gcc dot gnu.org
2015-03-17 15:21 ` rstrode at redhat dot com
2015-03-25 8:48 ` mpolacek at gcc dot gnu.org
2015-03-25 8:53 ` mpolacek at gcc dot gnu.org
2015-08-12 11:02 ` mpolacek 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).