From patchwork Wed Nov 22 19:24:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 24451 Received: (qmail 68386 invoked by alias); 22 Nov 2017 19:24:54 -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 68377 invoked by uid 89); 22 Nov 2017 19:24:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, SPF_PASS, T_RP_MATCHES_RCVD, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: zimbra.cs.ucla.edu Subject: Re: Fix regcomp.c build for 32-bit with GCC mainline To: Andreas Schwab Cc: Joseph Myers , Adhemerval Zanella , libc-alpha@sourceware.org, Gnulib bugs References: <28db5aad-0b87-2e05-5bcd-56a2d8407cf5@linaro.org> From: Paul Eggert Message-ID: Date: Wed, 22 Nov 2017 11:24:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: On 11/21/2017 01:11 AM, Andreas Schwab wrote: > This needs to go in a comment. Sure, I installed the attached into glibc and merged it into Gnulib. From 0285e6bdf223314d7751a83795001c0e87a1f825 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 22 Nov 2017 11:21:44 -0800 Subject: [PATCH] * posix/regcomp.c (init_word_char): Add comments. --- ChangeLog | 4 ++++ posix/regcomp.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 013d1e47e5..e67b128fe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-11-22 Paul Eggert + + * posix/regcomp.c (init_word_char): Add comments. + 2017-11-22 Joseph Myers [BZ #22447] diff --git a/posix/regcomp.c b/posix/regcomp.c index 520596b51b..81c2932991 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -925,12 +925,15 @@ init_word_char (re_dfa_t *dfa) int ch = 0; if (BE (dfa->map_notascii == 0, 1)) { + /* Avoid uint32_t and uint64_t as some non-GCC platforms lack + them, an issue when this code is used in Gnulib. */ bitset_word_t bits0 = 0x00000000; bitset_word_t bits1 = 0x03ff0000; bitset_word_t bits2 = 0x87fffffe; bitset_word_t bits3 = 0x07fffffe; if (BITSET_WORD_BITS == 64) { + /* Pacify gcc -Woverflow on 32-bit platformns. */ dfa->word_char[0] = bits1 << 31 << 1 | bits0; dfa->word_char[1] = bits3 << 31 << 1 | bits2; i = 2; -- 2.14.3