From patchwork Thu Feb 1 20:38:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 25743 Received: (qmail 122304 invoked by alias); 1 Feb 2018 20:38:10 -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 122288 invoked by uid 89); 1 Feb 2018 20:38:09 -0000 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=9016 X-HELO: relay1.mentorg.com Date: Thu, 1 Feb 2018 20:38:02 +0000 From: Joseph Myers To: Subject: Fix -Os strcoll, wcscoll, build (bug 21313) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) The findidx functions used in implementing strcoll / wcscoll already use DIAG_IGNORE_Os_NEEDS_COMMENT for spurious -Wmaybe-uninitialized warnings that appear with -Os. In building with GCC 7 for x86_64 with -Os, I find there are additional such warnings, for the same structure elements, which are spurious for the same reasons given in the existing comments (and this was also reported for MIPS with GCC 5 in bug 21313). This patch adds corresponding uses of DIAG_* in the places that get the additional warnings. Tested for x86_64 with -Os that this eliminates those warnings and so allows the build to progress further. 2018-02-01 Joseph Myers [BZ #21313] * locale/weight.h (findidx): Disable -Wmaybe-uninitialized for -Os in another place. * locale/weightwc.h (findidx): Likewise. Reviewed-by: Adhemerval Zanella diff --git a/locale/weight.h b/locale/weight.h index e2fdae1..6028d35 100644 --- a/locale/weight.h +++ b/locale/weight.h @@ -132,7 +132,15 @@ findidx (const int32_t *table, do { offset <<= 8; + /* With GCC 7 when compiling with -Os the compiler + warns that seq1.back_us and seq2.back_us, which + become usrc, might be used uninitialized. This + is impossible for the same reason as described + above. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized"); offset += usrc[cnt] - cp[cnt]; + DIAG_POP_NEEDS_COMMENT; } while (++cnt < nhere); } diff --git a/locale/weightwc.h b/locale/weightwc.h index 682d2b4..ac25ba9 100644 --- a/locale/weightwc.h +++ b/locale/weightwc.h @@ -90,9 +90,16 @@ findidx (const int32_t *table, size_t cnt; size_t offset; + /* With GCC 7 when compiling with -Os the compiler warns + that seq1.back_us and seq2.back_us, which become usrc, + might be used uninitialized. This is impossible for the + same reason as described above. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (7, "-Wmaybe-uninitialized"); for (cnt = 0; cnt < nhere - 1 && cnt < len; ++cnt) if (cp[cnt] != usrc[cnt]) break; + DIAG_POP_NEEDS_COMMENT; if (cnt < nhere - 1) {