From patchwork Thu Apr 4 19:17:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jansa X-Patchwork-Id: 1077624 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-101183-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="Ex4o63ck"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="izRbzTr/"; 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 44Zt543NP5z9sPf for ; Fri, 5 Apr 2019 06:17:59 +1100 (AEDT) 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; q=dns; s= default; b=n90/Ua0IrBOs1d7uMd/K7nMfiEQ987Jml7Fpfwxnvu1AvoZp+P74W TH6EmyjdZ3UE+fWvwcbENwVucVkK+VCUm3oEuKRtgC7s/mHC+aaQsINXlcp3xr6w 2v/dnTylikMsTQVYq9nZAON0UPaBdYdzoAibKJoG9CWBNp56AZbeoQ= 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; s=default; bh=2Ux0+uyjpRzav+o9Dn22lZbOJwk=; b=Ex4o63ck5m9LjeuyjMn/813x+UDA 2BM0XKTK3vdzb0Kxt+2aVgEsCyND4xPVIienVYSzcJuw9MPlTS7UVhzIAGg8CrlK sjNp/I+bxx/QVRS3QXYy5p+3PeCHitV2upY3HityKmOsUiJ2zB8SpGtSOBUFtpcl vD7cBqhV7Xr21CE= Received: (qmail 89600 invoked by alias); 4 Apr 2019 19:17:53 -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 89592 invoked by uid 89); 4 Apr 2019 19:17:53 -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.1 spammy=prevent X-HELO: mail-wr1-f65.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; bh=GK1nJvGNkj+WGBVtnaKrF3Rb9YE+0lt2G4fTmVw421Q=; b=izRbzTr/jwWyatY7CJfJDpjMmV6C3FpACWaxoJNwSlOs7+SGd04jJPNUAYAdShXZxk 5iJfZQmXOrFLZXwPz9snzPz3YGZLrZDUDHTB4dW+KzZhH848UUoGFOsbEfuAXeZm2zkY qLo1O6k2vVDib0iRJjujQ6dcUl8Zb+KjUzoWPU+VB19hzFuVjmzv5dm2Cy2P9DfoJlhc Cj9iDejaBZ6jTxBVQT7EsjsqEOnz2ODYLZURWmhwpdx7kgTbdmGOZ+XOrE5p+UG3m987 NHyt7q/Sghf+aw3Hp79m8uuZRROYJonJzW+S0n0FEeTW0SD4bZ8SiOkrjHL1TfO4VhFz wcaA== From: Martin Jansa To: libc-alpha@sourceware.org Cc: Martin Jansa Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ #19444] Date: Thu, 4 Apr 2019 19:17:48 +0000 Message-Id: <20190404191748.105-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 | 5 +++++ locale/weight.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index b00c783bcc..73db7b5012 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-04-04 Martin Jansa + + Partial fix for [BZ #19444] + * locale/weight.h: Fix build with -Os. + 2019-04-04 Adhemerval Zanella * sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcsrchr.c): diff --git a/locale/weight.h b/locale/weight.h index 7ca81498b2..d608ca70bb 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;