https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470
--- Comment #28 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- (In reply to Matthias Kretz (Vir) from comment #27) > Fair enough. But how can the compiler be certain that the developer realized > u and u % 100 is unsigned? Maybe when (s)he wrote the code the expectation > was for the RHS to be within [-99..99]. Indeed. (I never use % when its LHS can be either positive or negative, so that I didn't think about this case.) Now, the cause of the bug in such a case would be that the user messed up with the signedness of u, not because he forgot about the promotion rule. This is something rather different.