[PATCH] string: Fix GCC 11 `-Werror=stringop-overread' error

Maciej W. Rozycki macro@wdc.com
Mon Aug 31 13:29:13 GMT 2020


On Mon, 31 Aug 2020, Florian Weimer wrote:

> > Index: glibc/string/rawmemchr.c
> > ===================================================================
> > --- glibc.orig/string/rawmemchr.c
> > +++ glibc/string/rawmemchr.c
> > @@ -31,6 +31,8 @@ RAWMEMCHR (const void *s, int c)
> >    /* GCC 8 warns about the size passed to memchr being larger than
> >       PTRDIFF_MAX; the use of SIZE_MAX is deliberate here.  */
> >    DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow=");
> > +  /* Likewise GCC 11, with a different warning option.  */
> > +  DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
> >  #endif
> 
> I think this needs to be in its own __GNUC_PREREQ block because GCC 7
> does not have -Wstringop-overread.

 Umm, I never used this feature before and got confused with the version 
mismatch (7 vs 8) right above:

#if __GNUC_PREREQ (7, 0)
  DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow=");
#endif

misleading me into thinking GCC 7 is the version that introduced the 
`_Pragma' feature we use here.

 Joseph: has the mismatch been intentional?

 I have posted v2 now.

  Maciej


More information about the Libc-alpha mailing list