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

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).