This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65253] New: Wmemsize-comparison
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 28 Feb 2015 11:56:00 +0000
- Subject: [Bug c/65253] New: Wmemsize-comparison
- Auto-submitted: auto-generated
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