This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/65253] New: Wmemsize-comparison


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65253

            Bug ID: 65253
           Summary: Wmemsize-comparison
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org

Clang does:

remote.c:5519:47: warning: size argument in 'strncmp' call is a
comparison [-Wmemsize-comparison]
              && strncmp (p, "core", strlen ("core") != 0))
                                     ~~~~~~~~~~~~~~~~^~~~
remote.c:5519:11: note: did you mean to compare the result of 'strncmp'
instead?
              && strncmp (p, "core", strlen ("core") != 0))
                 ^                                       ~
                                                    )
remote.c:5519:31: note: explicitly cast the argument to size_t to
silence this warning
              && strncmp (p, "core", strlen ("core") != 0))
                                     ^
                                     (size_t)(           )

and it founds bugs in gdb: https://sourceware.org/ml/gdb/2015-02/msg00088.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]