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: 33394 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. */