From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joseph Myers Newsgroups: gmane.comp.lib.glibc.alpha Subject: Fix another -Os strcoll build issue Date: Fri, 23 Feb 2018 17:41:57 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Trace: blaine.gmane.org 1519407609 11672 195.159.176.226 (23 Feb 2018 17:40:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Feb 2018 17:40:09 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) To: Original-X-From: libc-alpha-return-90531-glibc-alpha=m.gmane.org@sourceware.org Fri Feb 23 18:40:05 2018 Return-path: Envelope-to: glibc-alpha@blaine.gmane.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=S64psIrHo+z+O52LmKVTX+W4w3L2b mfrmsFliWAzTRc277IgoxLKYff/3YwjHAftGLfarBxiYSQmE7NSIdb7dVFF89Knv 3ySyIR5+02jqJCAU36LLB2vIqSNzBhDOaWH/2cAX9SspTiDMddRRL0r/Ov11nMEs TYXDCO6DF5aDXU= 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:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=RhBdPNApJBX/vPrQd+HIC5cjqcI=; b=bDE AloicP2JI/EAbsPFbqyKDyrn+fT5XTyZYAtylWgb0s2rapnGXGfm9oiqFHGokiaZ 25ujU/FlNL1TZXaOCzO4KJCFFpxTTqebkfUXn8dncPjQSN5M8ka2VHPVfTPED8SI DL8pF1jZWG5Y77xny89+Wm3Irkqe840TSzNxDa5Q= 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: , Original-Sender: libc-alpha-owner@sourceware.org Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) Xref: news.gmane.org gmane.comp.lib.glibc.alpha:82863 Archived-At: Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epHKG-0002eW-3O for glibc-alpha@blaine.gmane.org; Fri, 23 Feb 2018 18:40:04 +0100 Received: (qmail 122746 invoked by alias); 23 Feb 2018 17:42:06 -0000 Received: (qmail 122357 invoked by uid 89); 23 Feb 2018 17:42:05 -0000 While there are now clean -Os build and test results on x86_64 (given my patch , pending review), testing with -Os with build-many-glibcs.py shows the build is still failing with -Os everywhere except for x86_64, x86 and s390x. There are a variety of different build failures, but the most common seem to be in strcoll / wcscoll, similar to existing such cases where DIAG_* are used to disable -Wmaybe-uninitialized. There are various different failures even within those functions. This patch fixes one particular case that seems quite common, where the warning appears at the declarations of seq1 and seq2. Tested with build-many-glibcs.py that this fixes the -Os build for aarch64-linux-gnu with GCC 7. 2018-02-23 Joseph Myers * string/strcoll_l.c: Include . (STRCOLL): Ignore -Wmaybe-uninitialized for -Os around declarations of seq1 and seq2. diff --git a/string/strcoll_l.c b/string/strcoll_l.c index 4a63c56..c001ff4 100644 --- a/string/strcoll_l.c +++ b/string/strcoll_l.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifndef STRING_TYPE # define STRING_TYPE char @@ -291,7 +292,17 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, locale_t l) int result = 0, rule = 0; + /* With GCC 7 when compiling with -Os the compiler warns that + seq1.back_us and seq2.back_us might be used uninitialized. + Sometimes this warning appears at locations in locale/weightwc.h + where the actual use is, but on architectures other than x86_64, + x86 and s390x, a warning appears at the definitions of seq1 and + seq2. 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 (7, "-Wmaybe-uninitialized"); coll_seq seq1, seq2; + DIAG_POP_NEEDS_COMMENT; seq1.len = 0; seq1.idxmax = 0; seq1.rule = 0; -- Joseph S. Myers joseph@codesourcery.com