From patchwork Wed Jul 22 11:58:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 498510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E58F41402B1 for ; Wed, 22 Jul 2015 21:59:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=XZuhvQY6; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=Ton5UtxeB0PlkUwrKiL1iEiSrO0G8 F4eV3pKw/e+GdVo09KAAYALGTLCABjPSYIdOK0doOnQuqIjQp7gnxFWnMJm/4sF9 cnJ11UEQMxm2mXzmiP355qaqQB8VdNWQoJlD7ooQ44ZUgctBm+MEuLcVE6Bih2kd Q02H4Ebz8709gY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:mime-version :content-type; s=default; bh=2XB97gzxI11tzuxLocDuCI7mqQw=; b=XZu hvQY67rijHVl/4zHpKEhKEdwsdKniSEXtC5zV+cKZ8GTgh+3jP4M8LSNwj0R241Q YV5bfb9O0GruYqnFoiJwzkqRjNRK+nkCT6WVmpnV7RiQjJZf5dErvI2jgisxoRrL H8RiaRwR+EiY0zGJfFXLipCNqpCeEBy47xXU7/uk= Received: (qmail 110623 invoked by alias); 22 Jul 2015 11:59:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 110608 invoked by uid 89); 22 Jul 2015 11:59:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: [PATCH] s390: Fix build error with gcc6 in utf8_utf16-z9.c. Date: Wed, 22 Jul 2015 13:58:54 +0200 Lines: 74 Message-ID: Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 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 * sysdeps/s390/s390-64/utf8-utf16-z9.c (MAX_NEEDED_INPUT): New define. (MAX_NEEDED_OUTPUT): New define. diff --git a/sysdeps/s390/s390-64/utf8-utf16-z9.c b/sysdeps/s390/s390-64/utf8-utf16-z9.c index 1425cb1..6712c1c 100644 --- a/sysdeps/s390/s390-64/utf8-utf16-z9.c +++ b/sysdeps/s390/s390-64/utf8-utf16-z9.c @@ -183,6 +183,7 @@ gconv_end (struct __gconv_step *data) #define MIN_NEEDED_INPUT MIN_NEEDED_FROM #define MAX_NEEDED_INPUT MAX_NEEDED_FROM #define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define MAX_NEEDED_OUTPUT MAX_NEEDED_TO #define LOOPFCT FROM_LOOP /* The software implementation is based on the code in gconv_simple.c. */ #define BODY \ @@ -340,6 +341,7 @@ gconv_end (struct __gconv_step *data) /* Conversion from UTF-16 to UTF-8. */ #define MIN_NEEDED_INPUT MIN_NEEDED_TO +#define MAX_NEEDED_INPUT MAX_NEEDED_TO #define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM #define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM #define LOOPFCT TO_LOOP