On Sat, Feb 26, 2022 at 2:14 PM Arnd Bergmann <arnd@xxxxxxxx> wrote: > > Could gcc follow the clang behavior then and skip the warning and > sanitizer for this case when -fno-strict-overflow or -fwrapv are used? Well, for the kernel, that horse has already left the barn, and we'd have to use -Wno-shift-negative-value anyway. But yes, from a sanity standpoint, it would be good to shut that warning up automatically if compiling for a 2's complement machine (ie "all of them") with -fwrapv. Considering that gcc doesn't support any non-2's-complement machines anyway afaik, and that the C standards people are also fixing the standard, and gcc has never done anything odd in this area in the first place, I think the warning is probably best removed entirely. But we'll have to do it manually for the existing situation. Linus