From patchwork Tue Jun 25 13:17:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 1122053 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-103049-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="qlznuaNo"; 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 45Y6CX03k0z9sCJ for ; Tue, 25 Jun 2019 23:17:43 +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:to:from:subject:date:mime-version:content-type :message-id; q=dns; s=default; b=Th6eIKbslqLbGHX0/a1eDuPgFvRpMCA UeWoz2wb5wDYmJ0qCnXvO7uzVu/B/0qIYuL1CwMTIxi4aATn41uOVWteIvtwqh4j puwgO3xYuR69I7241RyeT+zqpLkKgBsIt6X4YNXJo4mg7uizuamvmuJ9UJhsEhHE oTqnJw95rROo= 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:to:from:subject:date:mime-version:content-type :message-id; s=default; bh=KKWaikGjpc7wtuAv2kAs++utxg8=; b=qlznu aNo/BHUZFTeAVVJMgPX1V1C6v7rAiEF8f3cfz5d8GL1w8NwLhQTZeJwOaIevc4n1 ECXbDx1J6vQaXVvXkvcshGBozkdXzUOBFAiM2cnSay+lIKbiSohQlNgdGMzhf/eN l9KB9Ke7xcWdvW6RNfCDNET7rVKSROgz9z+a5s= Received: (qmail 50303 invoked by alias); 25 Jun 2019 13:17:37 -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 50294 invoked by uid 89); 25 Jun 2019 13:17:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library From: Stefan Liebler Subject: [PATCH] Fix build warnings in locale/programs/ld-ctype.c Date: Tue, 25 Jun 2019 15:17:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 x-cbid: 19062513-4275-0000-0000-000003461BB2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19062513-4276-0000-0000-000038561D1A Message-Id: <45faf360-cad3-7c9b-a914-0823d2724b90@linux.ibm.com> Hi, this patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x: programs/ld-ctype.c: In function ‘ctype_read’: programs/ld-ctype.c:1392:13: error: ‘wch’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1392 | uint32_t wch; | ^~~ programs/ld-ctype.c:1401:7: error: ‘seq’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1401 | if (seq != NULL && seq->nbytes == 1) | ^ programs/ld-ctype.c:1391:20: note: ‘seq’ was declared here 1391 | struct charseq *seq; | ^~~ Both seq and wch are uninitialized if get_character fails. Thus we are now returning with an error. Bye Stefan ChangeLog: * locale/programs/ld-ctype.c (charclass_symbolic_ellipsis): Return error if get_character fails. commit 0dca38c4afd868da65e0b5c0d76fc30bd3114994 Author: Stefan Liebler Date: Tue Jun 25 08:57:40 2019 +0200 Fix build warnings in locale/programs/ld-ctype.c This patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x: programs/ld-ctype.c: In function ‘ctype_read’: programs/ld-ctype.c:1392:13: error: ‘wch’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1392 | uint32_t wch; | ^~~ programs/ld-ctype.c:1401:7: error: ‘seq’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1401 | if (seq != NULL && seq->nbytes == 1) | ^ programs/ld-ctype.c:1391:20: note: ‘seq’ was declared here 1391 | struct charseq *seq; | ^~~ Both seq and wch are uninitialized if get_character fails. Thus we are now returning with an error. ChangeLog: * locale/programs/ld-ctype.c (charclass_symbolic_ellipsis): Return error if get_character fails. diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index e6105928da..cfc9c43fd5 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1396,7 +1396,8 @@ charclass_symbolic_ellipsis (struct linereader *ldfile, (int) (now->val.str.lenmb - (cp - last_str)), from); - get_character (now, charmap, repertoire, &seq, &wch); + if (get_character (now, charmap, repertoire, &seq, &wch)) + goto invalid_range; if (seq != NULL && seq->nbytes == 1) /* Yep, we can store information about this byte sequence. */