https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119011
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Not warning at all for a literal -1 seems reasonable to me. It's such a common idiom to compare to -1 for error checks. So suppress the warning only for the literal -1 (and no other spellings, such as -1L or ~0), and only if it's being compared to an unsigned integer type of rank not less than the rank of int. The suggestion makes sense to me.