Re: [BUG] allmodconfig build error in next-20240108

From: Paul E. McKenney
Date: Tue Jan 09 2024 - 22:46:35 EST


On Wed, Jan 10, 2024 at 09:58:22AM +1100, Stephen Rothwell wrote:
> Hi all,
>
> On Tue, 9 Jan 2024 14:45:56 -0800 "Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:
> >
> > On Wed, Jan 10, 2024 at 08:11:55AM +1100, Stephen Rothwell wrote:
> > >
> > > On Tue, 9 Jan 2024 10:58:40 -0600 Lucas De Marchi <lucas.demarchi@xxxxxxxxx> wrote:
> > > >
> > > > On Mon, Jan 08, 2024 at 03:15:23PM -0800, Paul E. McKenney wrote:
> > > > I could reproduce it with allmodconfig and gcc 11.4.1 from rockylinux,
> > > > but not with gcc 9.3 or 12.3. Also it's not reproduced with gcc 11.4.1
> > > > when using defconfig + CONFIG_DRM_XE (even if -Wstringop-overflow is
> > > > still added).
> > > >
> > > > I don't see a bug in the code, even if it inverts the head/tail
> > > > convention.
> > > >
> > > > Searching around showed this which may be relevant: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854
> > > > At least I can reproduce the same issue as in the snippet provided
> > > > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854#c7) with the buggy
> > > > compiler.
> > > >
> > > > So, maybe the best thing to do for now is to disable -Wstringop-overflow
> > > > for gcc < 12?
> > > >
> > > >
> > > > ------8<-----
> > > > diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> > > > index 6952da8979ea..0433a3c6cbfd 100644
> > > > --- a/drivers/gpu/drm/xe/Makefile
> > > > +++ b/drivers/gpu/drm/xe/Makefile
> > > > @@ -17,7 +17,7 @@ subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
> > > > subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
> > > > subdir-ccflags-y += $(call cc-option, -Wformat-overflow)
> > > > subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
> > > > -subdir-ccflags-y += $(call cc-option, -Wstringop-overflow)
> > > > +subdir-ccflags-$(call gcc-min-version, 120000) += $(call cc-option, -Wstringop-overflow)
> > > > subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
> > > > # The following turn off the warnings enabled by -Wextra
> > > > ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
> > > > ------8<-----
> >
> > This I did, thank you!
>
> Maybe that line "subdir-ccflags-y += $(call cc-option, -Wstringop-overflow)"
> should just be removed as the setting of that option has been moved to the
> normal C flags in the top level Makefile (out of Makefile.extrawarn).

If you meant like this, no joy. :-(

Thanx, Paul

------------------------------------------------------------------------

diff --git a/Makefile b/Makefile
index 0705e7426ab7..446bd2da9fa3 100644
--- a/Makefile
+++ b/Makefile
@@ -988,7 +988,6 @@ KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)

#Currently, disable -Wstringop-overflow for GCC 11, globally.
KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow)
-KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow)

# disable invalid "can't wrap" optimizations for signed / pointers
KBUILD_CFLAGS += -fno-strict-overflow