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

--- Comment #25 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
(In reply to Piotr Engelking from comment #24)
> It would be nice if the compiler noticed that rhs is always within
> 0..SHRT_MAX, so the comparison is not surprisingly affected by integer
> promotion.

The problem is the LHS which can be negative and has to be promoted to
`unsigned int`. This promotion changes the value from s to UINT_MAX + 1 + s. I
don't think this example is a case where -Wsign-compare should be silent.

Reply via email to