[PATCH] Get rid of array-bounds warning in __kernel_rem_pio2[f] with gcc 6.1 -O3.

Stefan Liebler stli@linux.vnet.ibm.com
Wed Jul 13 10:30:00 GMT 2016


PING

On 07/07/2016 10:22 AM, 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.
> Afterwards glibc builds/tests fine with gcc 6.1 and -O3.
>
> Okay to commit?
> Before or after release?
>
> Bye
> Stefan
>
> ChangeLog:
>
>      * sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2):
>      Add test to ensure that array-index is >= 0.
>      * sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
>      Likewise.



More information about the Libc-alpha mailing list