From patchwork Sun Sep 30 15:53:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jansa X-Patchwork-Id: 976907 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-96170-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="CIDxXRwv"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gBEc9xFi"; dkim-atps=neutral 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 42NVMp4nD9z9s4V for ; Mon, 1 Oct 2018 01:54:14 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=M5HBfvg/XVaDwNJfEyOIewDKCMTzL+X AZSxj5rpmk4aUwArKR6/QJisUdNlBGNLec/Odpacxq4XCB/oskm/D6Z+fkvKgeef zFCpaQzcEjzvAcPl3vMq9E2hu+7TzkTK5zehSkM9vHURiKjNFfy/cIgl8GtumOUE wRcVdi5SErHU= 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:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=CYRtWPEwoTyKPRiymlwY4GgJeC4=; b=CIDxX Rwvlm4a0ncPvtCDuaQJBc33FNK+QZskInuaUtdw2LAYlK5k4JHgjPcUbrchHoNHB R5VdV8O7KNkhpZPM8nge1TQzCZAxvQvDuy+fn70G6Kz5os7eRt/qcG+/nJZznM1Z xl5o8qa35wTLO6qhGPVXkA71p+/SFR6kIKtwYM= Received: (qmail 44797 invoked by alias); 30 Sep 2018 15:54:08 -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 44788 invoked by uid 89); 30 Sep 2018 15:54:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.5 required=5.0 tests=AWL, 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=H*RU:209.85.128.67, Hx-spam-relays-external:209.85.128.67 X-HELO: mail-wm1-f67.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=kahAe+QdpheaT5xpYZNlfvqN1mNVNnbahU4JsSvb82c=; b=gBEc9xFiAhKNxzA1yVElkKSE3a9m3t53IUOLUxbF8j6PkuX6ISV1w+uGZyxRZ6OZSO SpqZqpdTLIFVej1yYjiK7ZWks1CjYBBIiCrz/7Wn8NdUt+Jv2OztLZzMLQGiZkdqCUT1 LVydOmwf0yETf1el7wnH8ATxJSLQlV54k+W1G0/dHK3JtRR0qM/FXf8AeCwebyzrhCGt ZjcMgPe+RePI+PUO2J/25nZEi4eWmSdCZCl1ItaBD+AQfQkG0st2yGjbOUgpuJaXXtyc flL6fQ076Zb4ArC9RytBhZqdtqMXj8NDlIoLXHvCi+Zq0m005i36B4FHmKhOYunRj5tm /WTQ== From: Martin Jansa To: libc-alpha@sourceware.org Cc: Martin Jansa Subject: [PATCH 3/3] locale: prevent maybe-uninitialized errors with -Os [BZ #19444] Date: Sun, 30 Sep 2018 15:53:55 +0000 Message-Id: <20180930155355.30989-1-Martin.Jansa@gmail.com> In-Reply-To: References: 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 #23716] * 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 9cdf59c9ab..ef506309aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-09-30 Martin Jansa + Partial fix for [BZ #23716] + * locale/weight.h: Fix build with -Os. + 2018-09-30 Martin Jansa Partial fix for [BZ #23716] * sysdeps/ieee754/soft-fp/s_fdiv.c: Fix build with -O. 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;