From patchwork Mon Dec 17 21:36:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jansa X-Patchwork-Id: 30701 Received: (qmail 62473 invoked by alias); 17 Dec 2018 21:36:29 -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 62338 invoked by uid 89); 17 Dec 2018 21:36:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zehjJkMF41bjvFRRT79kYAbBc1J62kLaCBUvx2pkxOg=; b=FSZXA/9xQZOY7/zAxsFCQjLUX0RveqWuKV+mBLFw/G4H6PsKMQjhBgvdR+S7LoJcr1 HNiKlIiqeF7IJ08rNyuuj6WhTW8NcbygPYQMreoIdp9tf6KunXmP+2c6/76ORujlYZSs mgV+YmvEjTdggelmTYGrnanSVp1+2rY+VWA9yO/t6xMnRggcZD/unf+Ure1WY1Izqdyt zHVQ6RvO1btVBMsdVCty/3MXUswz8ihFjVQeAHp98qAK+RjlQ2JAuODL1imB89RtCj/z G8LSrR6ntrnC9k9ZAsC+deYx6M/szTWocOanprD2hBUAD2MI2QERjE8LdVUS+wmKJUDh l9QQ== Return-Path: From: Martin Jansa To: libc-alpha@sourceware.org Cc: Martin Jansa Subject: [PATCHv2 3/3] locale: prevent maybe-uninitialized errors with -Os [BZ #19444] Date: Mon, 17 Dec 2018 21:36:18 +0000 Message-Id: <20181217213618.29538-1-Martin.Jansa@gmail.com> In-Reply-To: <20180930155355.30989-1-Martin.Jansa@gmail.com> References: <20180930155355.30989-1-Martin.Jansa@gmail.com> Fixes following error when building for aarch64 with -Os: | In file included from strcoll_l.c:43: | strcoll_l.c: In function '__strcoll_l': | ../locale/weight.h:31:26: error: 'seq2.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] | int_fast32_t i = table[*(*cpp)++]; | ^~~~~~~~~ | strcoll_l.c:304:18: note: 'seq2.back_us' was declared here | coll_seq seq1, seq2; | ^~~~ | In file included from strcoll_l.c:43: | ../locale/weight.h:31:26: error: 'seq1.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] | int_fast32_t i = table[*(*cpp)++]; | ^~~~~~~~~ | strcoll_l.c:304:12: note: 'seq1.back_us' was declared here | coll_seq seq1, seq2; | ^~~~ Partial fix for [BZ #19444] * locale/weight.h: Fix build with -Os. Signed-off-by: Martin Jansa --- ChangeLog | 4 ++++ locale/weight.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2e12129846..2d5679c112 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018-12-17 Martin Jansa + Partial fix for [BZ #19444] + * locale/weight.h: Fix build with -Os. + +2018-12-17 Martin Jansa Partial fix for [BZ #19444] * sysdeps/ieee754/dbl-96/e_jnl.c: Fix build with -O * sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise. diff --git a/locale/weight.h b/locale/weight.h index 6028d3595e..10bcea25e5 100644 --- a/locale/weight.h +++ b/locale/weight.h @@ -28,7 +28,14 @@ findidx (const int32_t *table, const unsigned char *extra, const unsigned char **cpp, size_t len) { + /* With GCC 8 when compiling with -Os the compiler warns that + seq1.back_us and seq2.back_us might be used uninitialized. + This uninitialized use is impossible for the same reason + as described in comments in locale/weightwc.h. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); int_fast32_t i = table[*(*cpp)++]; + DIAG_POP_NEEDS_COMMENT; const unsigned char *cp; const unsigned char *usrc;