On Wed, Feb 23, 2022 at 10:47 AM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > Arnd - remind me, please.. Was there some other problem than just gcc-4.9? Hmm. Interesting. I decided to just try it and see for the compiler I have, and changing the gnu89 to gnu99 I get new warnings (-Werror=shift-negative-value). Very annoying. Especially since negative values are in many contexts actually *safer* than positive ones when used as a mask, because as long as the top bit is set in 'int', if the end result is then expanded to some wider type, the top bit stays set. Example: unsigned long mask(unsigned long x) { return x & (~0 << 5); } unsigned long badmask(unsigned long x) { return x & (~0u << 5); } One does it properly, the other is buggy. Now, with an explicit "unsigned long" like this, some clueless compiler person might say "just use "~0ul", but that's completely wrong - because quite often the type is *not* this visible, and the signed version works *regardless* of type. So this Werror=shift-negative-value warning seems to be actively detrimental, and I'm not seeing the reason for it. Can somebody explain the thinking for that stupid warning? That said, we seem to only have two cases of it in the kernel, at least by a x86-64 allmodconfig build. So we could examine the types there, or we could just add '-Wno-shift-negative-value". Linus