[PATCH] Avoid array-bounds warning in testsuite on i586

Florian Weimer fweimer@redhat.com
Wed Jun 29 11:32:00 GMT 2016


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




More information about the Libc-alpha mailing list