On Sun, Feb 27, 2022 at 10:28:41PM +0100, Arnd Bergmann wrote: > On Sun, Feb 27, 2022 at 2:09 AM Segher Boessenkool > <segher@xxxxxxxxxxxxxxxxxxx> wrote: > > > > So imo we should just never do this by default, not just if the nasty > > -fwrapv or nastier -fno-strict-overflow is used, just like we suggest > > in our own documentation. The only valid reason -Wshift-negative-value > > is in -Wextra is it warns for situations that always are undefined > > behaviour (even if not in GCC). > > Ok, I just realized that this is specific to the i915 driver because > that, unlike > most of the kernel builds with -Wextra by default. -Wextra is enabled when > users ask for a 'make W=1' build in linux, and i915 is one of just three > drivers that enable an equivalent set of warnings, the other ones > being greybus and btrfs. > > This means to work around the extra warnings, we also just need to disable > it in the W=1 part of scripts/Makefile.extrawarn, as well as the three drivers > that copy those options, but not the default warnings that don't include them. Ah good, all of the workaround in one simple place, neat. > > Could you open a GCC PR for this? The current situation is quite > > suboptimal, and what we document as our implementation choice is much > > more useful! > > I hope I managed to capture the issue in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104711 That looks fine. Thank you! (I attached the testcase to the bug itself, we prefer it that way, maybe godbolt will go away some day, who knows.) Segher