Hi,
i get the following build error on s390x building utf8_utf16-z9.c with
gcc 6:
In file included from ../include/sys/cdefs.h:3:0,
from ../include/features.h:365,
from ../dlfcn/dlfcn.h:22,
from ../include/dlfcn.h:2,
from ../sysdeps/s390/s390-64/utf8-utf16-z9.c:27:
../iconv/skeleton.c: In function 'gconv':
../sysdeps/s390/s390-64/utf8-utf16-z9.c:430:30: error: array subscript
is above array bounds [-Werror=array-bounds]
if (__glibc_unlikely (inptr + 2 > inend)) \
^
../misc/sys/cdefs.h:385:52: note: in definition of macro '__glibc_unlikely'
# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
^
../iconv/loop.c:435:7: note: in expansion of macro 'BODY'
BODY
^
While including loop.c to construct the SINGLE(LOOPFCT) method for
converting from UTF-16 to UTF-8, the bytebuf array with length
MAX_NEEDED_INPUT is used as inptr. MAX_NEEDED_INPUT defaults to
MIN_NEEDED_INPUT if not defined before including loop.c.
Thus bytebuf has a length of 2.
This patch defines MAX_NEEDED_INPUT to MAX_NEEDED_TO, which is 4.
Ok for 2.22 or later?
Bye
Stefan
---
2015-07-22 Stefan Liebler <stli@linux.vnet.ibm.com>
* sysdeps/s390/s390-64/utf8-utf16-z9.c
(MAX_NEEDED_INPUT): New define.
(MAX_NEEDED_OUTPUT): New define.