[Bug c/65253] Wmemsize-comparison

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 28 18:54:00 GMT 2017


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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-09-28
                 CC|                            |egallager at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #0)
> 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

I'll take the gdb discussion as confirmation


More information about the Gcc-bugs mailing list