On Sat, Feb 26, 2022 at 1:42 PM Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> wrote: > On Wed, Feb 23, 2022 at 11:23:39AM -0800, Linus Torvalds wrote: > > 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". > > Yes. > > The only reason the warning exists is because it is undefined behaviour > (not implementation-defined or anything). The reason it is that in the > standard is that it is hard to implement and even describe for machines > that are not two's complement. However relevant that is today :-) Could gcc follow the clang behavior then and skip the warning and sanitizer for this case when -fno-strict-overflow or -fwrapv are used? Arnd