From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7330 invoked by alias); 22 Oct 2018 13:02:24 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 7273 invoked by uid 89); 22 Oct 2018 13:02:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1338 X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Oct 2018 13:02:21 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C95CF30012D7 for ; Mon, 22 Oct 2018 13:02:20 +0000 (UTC) Received: from oldenburg.str.redhat.com (dhcp-192-212.str.redhat.com [10.33.192.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9437419484 for ; Mon, 22 Oct 2018 13:02:20 +0000 (UTC) Received: by oldenburg.str.redhat.com (Postfix, from userid 1000) id 044184399457D; Mon, 22 Oct 2018 15:02:20 +0200 (CEST) Date: Mon, 01 Jan 2018 00:00:00 -0000 To: libc-stable@sourceware.org Subject: [2.26 COMMITTED] Fix string/bug-strncat1.c build with GCC 8. User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20181022130220.044184399457D@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 22 Oct 2018 13:02:20 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00009.txt.bz2 From: Joseph Myers GCC 8 warns about strncat calls with truncated output. string/bug-strncat1.c tests such a call; this patch disables the warning for it. Tested (compilation) with GCC 8 for x86_64-linux-gnu with build-many-glibcs.py (in conjunction with Martin's patch to allow glibc to build). * string/bug-strncat1.c: Include . (main): Disable -Wstringop-truncation for strncat call for GCC 8. (cherry picked from commit ec72135e5f1d061cb5cf7cd1b855fd6290be10d9) 2017-11-14 Joseph Myers * string/bug-strncat1.c: Include . (main): Disable -Wstringop-truncation for strncat call for GCC 8. diff --git a/string/bug-strncat1.c b/string/bug-strncat1.c index f1b5c37c5c..b22beba4d3 100644 --- a/string/bug-strncat1.c +++ b/string/bug-strncat1.c @@ -4,13 +4,21 @@ #include #include #include +#include char d[3] = "\0\1\2"; int main (void) { + DIAG_PUSH_NEEDS_COMMENT; +#if __GNUC_PREREQ (8, 0) + /* GCC 8 warns about strncat truncating output; this is deliberately + tested here. */ + DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation"); +#endif strncat (d, "\5\6", 1); + DIAG_POP_NEEDS_COMMENT; if (d[0] != '\5') { puts ("d[0] != '\\5'");