https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102440
--- Comment #9 from Segher Boessenkool <segher at gcc dot gnu.org> --- (In reply to Martin Liška from comment #8) > > We could make the "UInteger" type mean it is implemented with an "unsigned > > int" > > C type (or some other unsigned integer type). > > This would lead to the following list of -Wsign-compare warnings: > > /home/marxin/Programming/gcc/gcc/c-family/c-opts.c:934:27: warning: > comparison of integer expressions of different signedness: ‘unsigned int’ > and ‘int’ [-Wsign-compare] That line is if (warn_shift_overflow == -1) The documentation for that warning flag says '-Wsign-compare' Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. In C++, this warning is also enabled by '-Wall'. In C, it is also enabled by '-Wextra'. I don't see how this could produce an incorrect result. Writing the code as if (warn_shift_overflow == -1U) means exactly the same thing, except it assumes the size of the variable so it is a bad habit. Plain "-1" is easier to read anyway. It is idiom to use -1 for all-bits-set for unsigned vars. It works correctly whatever the size of the variable is. It is silly if if (warn_shift_overflow == -1) warns, but if (warn_shift_overflow + 1 == 0) is just dandy (and that is the current situation :-( ) > One would need to verify/adjust all these places (plus many more for other > targets). Or fix the bloody warning ;-) But not something you want on your plate, I fully understand :-)