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

--- Comment #20 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
I think the changed title describes an INVALID bug: there is no false positive,
-Wsign-compare is behaving as it's meant to and diagnosing cases where the
comparison of values of integer type involves an implicit conversion from
signed to signed that might change an integer value, so it doesn't act as a
heterogeneous comparison of values as if they were infinite-precision integers.

I don't object to having a more specific -Wno-sign-compare-negative-constant or
similar that excludes warning for the cases discussed here where a particular
code idiom intends the implicit conversion to occur (especially considering the
risks involved in adding a cast if the cast ends up being to the wrong type).

Reply via email to