Message ID | mvm60ssicqy.fsf@hawking.suse.de |
---|---|
State | New |
Headers | show |
On 06/29/2016 11:08 AM, Andreas Schwab wrote: > gcc-6 is complaining about this, breaking the testsuite run: > > In file included from ../string/string.h:627:0, > from ../include/string.h:54, > from tester.c:32, > from inl-tester.c:6: > tester.c: In function 'test_strncat': > ../sysdeps/x86/bits/string.h:1092:3: error: array subscript is below array bounds [-Werror=array-bounds] > --__tmp; > ^~~~~~~ > > I don't see any other way to avoid the warning. We could move the decrement operation into the assembly part, where GCC cannot see it. Or we could cast to uintptr_t before subtracting 1. > +# Suppress array bounds warning from strncat macro in > +# sysdeps/x86/bits/string.h when building for i[345]86 > +CFLAGS-inl-tester.c += -Wno-array-bounds It's triggered by an installed header, so this does not fix the bug at all. I expect applications run into the warning as well. Thanks, Florian
Florian Weimer <fweimer@redhat.com> writes: > It's triggered by an installed header, so this does not fix the bug at > all. I expect applications run into the warning as well. Only if compiled with -Wsystem-headers. Andreas.
On 06/29/2016 01:58 PM, Andreas Schwab wrote: > Florian Weimer <fweimer@redhat.com> writes: > >> It's triggered by an installed header, so this does not fix the bug at >> all. I expect applications run into the warning as well. > > Only if compiled with -Wsystem-headers. I would expect that this could trip ubsan as well. Florian
diff --git a/string/Makefile b/string/Makefile index 9c87419..48a0e85 100644 --- a/string/Makefile +++ b/string/Makefile @@ -64,12 +64,12 @@ endif include ../Rules -CFLAGS-inl-tester.c = -fno-builtin -CFLAGS-noinl-tester.c = -fno-builtin -CFLAGS-tst-strlen.c = -fno-builtin -CFLAGS-stratcliff.c = -fno-builtin -CFLAGS-test-ffs.c = -fno-builtin -CFLAGS-tst-inlcall.c = -fno-builtin +CFLAGS-inl-tester.c += -fno-builtin +CFLAGS-noinl-tester.c += -fno-builtin +CFLAGS-tst-strlen.c += -fno-builtin +CFLAGS-stratcliff.c += -fno-builtin +CFLAGS-test-ffs.c += -fno-builtin +CFLAGS-tst-inlcall.c += -fno-builtin ifeq ($(run-built-tests),yes) $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile index 6c91842..a0e80a9 100644 --- a/sysdeps/i386/Makefile +++ b/sysdeps/i386/Makefile @@ -7,6 +7,10 @@ long-double-fcts = yes ifeq ($(subdir),string) sysdep_routines += cacheinfo + +# Suppress array bounds warning from strncat macro in +# sysdeps/x86/bits/string.h when building for i[345]86 +CFLAGS-inl-tester.c += -Wno-array-bounds endif ifeq ($(subdir),gmon)