From patchwork Mon Dec 18 22:53:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 24998 Received: (qmail 112708 invoked by alias); 18 Dec 2017 22:53:29 -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 112654 invoked by uid 89); 18 Dec 2017 22:53:29 -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= X-HELO: relay1.mentorg.com Date: Mon, 18 Dec 2017 22:53:21 +0000 From: Joseph Myers To: Subject: Disable strncat test array-bounds warnings for GCC 8 [committed] 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) Some strncat tests fail to build with GCC 8 because of -Warray-bounds warnings. These tests are deliberately test over-large size arguments passed to strncat, and already disable -Wstringop-overflow warnings, but now the warnings for these tests come under -Warray-bounds so that option needs disabling for them as well, which this patch does (with an update on the comments; the DIAG_IGNORE_NEEDS_COMMENT call for -Warray-bounds doesn't need to be conditional itself, because that option is supported by all versions of GCC that can build glibc). Tested compilation with build-many-glibcs.py for aarch64-linux-gnu. Committed. 2017-12-18 Joseph Myers * string/tester.c (test_strncat): Also disable -Warray-bounds warnings for two tests. diff --git a/string/tester.c b/string/tester.c index 66b1151..02ea8e1 100644 --- a/string/tester.c +++ b/string/tester.c @@ -387,9 +387,11 @@ test_strncat (void) DIAG_PUSH_NEEDS_COMMENT; #if __GNUC_PREREQ (7, 0) /* GCC 7 warns about the size passed to strncat being larger than - the size of the buffer; this is deliberately tested here.. */ + the size of the buffer; this is deliberately tested here; GCC 8 + gives a -Warray-bounds warning about this. */ DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow="); #endif + DIAG_IGNORE_NEEDS_COMMENT (8, "-Warray-bounds"); (void) strncat (one, two, 99); DIAG_POP_NEEDS_COMMENT; equal (one, "ghef", 5); /* Basic test encore. */ @@ -480,9 +482,11 @@ test_strncat (void) #if __GNUC_PREREQ (7, 0) /* GCC 7 warns about the size passed to strncat being larger than the size of the buffer; this is - deliberately tested here.. */ + deliberately tested here; GCC 8 gives a -Warray-bounds + warning about this. */ DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow="); #endif + DIAG_IGNORE_NEEDS_COMMENT (8, "-Warray-bounds"); check (strncat (buf1 + n2, buf2 + n1, ~((size_t) 0) - n4) == buf1 + n2, ntest); DIAG_POP_NEEDS_COMMENT;