From patchwork Tue Jul 24 16:10:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 28589 Received: (qmail 94288 invoked by alias); 24 Jul 2018 16:10:33 -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 94279 invoked by uid 89); 24 Jul 2018 16:10:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de From: Andreas Schwab To: Steve Ellcey Cc: libc-alpha Subject: Re: ToT build error with ToT GCC on Aarch64 References: <1532361092.15609.7.camel@cavium.com> X-Yow: Awright, which one of you hid my PENIS ENVY? Date: Tue, 24 Jul 2018 18:10:27 +0200 In-Reply-To: <1532361092.15609.7.camel@cavium.com> (Steve Ellcey's message of "Mon, 23 Jul 2018 08:51:32 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 On Jul 23 2018, Steve Ellcey wrote: > In file included from fnmatch.c:244: > fnmatch_loop.c: In function ‘internal_fnwmatch’: > ../locale/weightwc.h:124:28: error: array subscript 1 is outside array bounds of >  ‘wint_t[1]’ {aka ‘unsigned int[1]’} [-Werror=array-bounds] >     if (cp[nhere - 1] > usrc[nhere -1]) >                         ~~~~^~~~~~~~~~ > In file included from fnmatch.c:244: > fnmatch_loop.c: In function ‘internal_fnwmatch’: > ../locale/weightwc.h:124:28: error: array subscript 1 is outside array bounds of >  ‘wint_t[1]’ {aka ‘unsigned int[1]’} [-Werror=array-bounds] >     if (cp[nhere - 1] > usrc[nhere -1]) >                         ~~~~^~~~~~~~~~ > cc1: all warnings being treated as errors > ../o-iterator.mk:9: recipe for target '/home/sellcey/tot/obj/glibc64/posix/fnmat > ch.o' failed I think this is the correct change. The cnt == len check matches what is done in weight.h, and is needed when nhere - 1 == len and usrc is a prefix of cp. Andreas. * locale/weightwc.h (findidx): Handle the case where usrc is a prefix of cp but one character too short. --- locale/weightwc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/weightwc.h b/locale/weightwc.h index 36c65b5623..7ee335dc9a 100644 --- a/locale/weightwc.h +++ b/locale/weightwc.h @@ -109,7 +109,7 @@ findidx (const int32_t *table, break; DIAG_POP_NEEDS_COMMENT; - if (cnt < nhere - 1) + if (cnt < nhere - 1 || cnt == len) { cp += 2 * nhere; continue; @@ -121,14 +121,14 @@ findidx (const int32_t *table, same reason as described above. */ DIAG_PUSH_NEEDS_COMMENT; DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized"); - if (cp[nhere - 1] > usrc[nhere -1]) + if (cp[nhere - 1] > usrc[nhere - 1]) { cp += 2 * nhere; continue; } DIAG_POP_NEEDS_COMMENT; - if (cp[2 * nhere - 1] < usrc[nhere -1]) + if (cp[2 * nhere - 1] < usrc[nhere - 1]) { cp += 2 * nhere; continue;