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.

Reply via email to