This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Get rid of array-bounds warning in __kernel_rem_pio2[f] with gcc 6.1 -O3.
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Stefan Liebler <stli at linux dot vnet dot ibm dot com>
- Cc: <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Wed, 20 Jul 2016 16:33:50 +0000
- Subject: Re: [PATCH] Get rid of array-bounds warning in __kernel_rem_pio2[f] with gcc 6.1 -O3.
- Authentication-results: sourceware.org; auth=none
- References: <577E1156.2030604@linux.vnet.ibm.com>
On Thu, 7 Jul 2016, Stefan Liebler wrote:
> Hi,
>
> while testing, I've got the following werror on s390x when build with gcc 6.1
> (or current gcc head) and -O3:
> ../sysdeps/ieee754/dbl-64/k_rem_pio2.c: In function ‘__kernel_rem_pio2’:
> ../sysdeps/ieee754/dbl-64/k_rem_pio2.c:254:18: error: array subscript is below
> array bounds [-Werror=array-bounds]
> for (k = 1; iq[jk - k] == 0; k++)
> ~~^~~~~~~~
>
> I get the same error with sysdeps/ieee754/flt-32/k_rem_pio2f.c.
>
> Does anybody else get this warning on another architecture, too?
>
> This patch adds a check so that the index is always >= 0.
Such an unnecessary check is not how we deal with bogus warnings.
Rather, use the DIAG_*_NEEDS_COMMENT macros from include/libc-internal.h,
with a detailed comment explaining what the warning is and why it is a
false positive.
--
Joseph S. Myers
joseph@codesourcery.com