https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66773
--- Comment #14 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- (In reply to Segher Boessenkool from comment #11) > Do you have examples of perfectly fine code where you get a warning? In addition to Daniel's example, I would say that one can have types that are signed but the values are always nonnegative in practice (the goal of having signed types is to be able to do signed arithmetic on them when using other signed types). For instance, this is the case of mpfr_prec_t in GNU MPFR (this contains a precision). Thus it is fine to compare it with a value of type unsigned. And adding casts to avoid the warning (in addition to being a hack) is not even always possible, because one may not know the associated unsigned type.