From patchwork Tue Oct 1 21:50:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1170278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105561-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Js2cKA6S"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46jXy24NLVz9sPL for ; Wed, 2 Oct 2019 07:50:34 +1000 (AEST) 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=muwqApdIVnzz4Ow8N0n2fUKddMyMY 1PaxY5jUFOXvQYz1WJm+CWba4f2CgAn1CRI1m8VCCuE3lmfG72e8xURgETFpF0u6 zc/D04CY9xdOg1k2SO3C39Z2cLV8xnrO3STwRGOQXUqyGZLrVz8ekS/P5dh56N/s qCbkChaHpze0hA= 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=N2RMVuooFCqJkV3al/ddsYG09qk=; b=Js2 cKA6SCkpySnrtjq1+enECCjUF40rwM+MbR6OOI2VC/R1NdfS03DGrO+iEk0n4/Gu 9ImzQq2SXwqhW8YJcn+tq9awQW0dw+mYU7xaH/mWSiTa2ixBZJeKcWWsFuc3nF6l vdLZ36EyrJ4g36NCcmqsLKfusY1zpov9o+I0fF4Y= Received: (qmail 1679 invoked by alias); 1 Oct 2019 21:50:28 -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 1486 invoked by uid 89); 1 Oct 2019 21:50:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy=dubious, duly X-HELO: esa2.mentor.iphmx.com IronPort-SDR: o46B6JBUOLSbj7MlNqrAYp2NQezdY42fd8gNM6Lh/BN+B2jQjgthwWqNvzjKkG9xcMGapDKuOV 05evHB7Kyfbk4BTjn/ZMIiZhlitbiz1+jk1SSVc9p+xnmOmmONLWtDXrdHrAuCnwgqNd0OOYqV +zT8bBFBlHLcOu2Pp1pP7kl23JsaZCVd7PsKtQh0WJHhES2VA84AnSKB+xTMB4fp+VIhgXlbKx 4C3MiVsa/yj8Zy+wts12D1uK6DxA4QX0yfR6T+K2O1Y21ap8X4jFB6bYlvi8DmPdp21xWOvi8g +6I= IronPort-SDR: k5Zb3nFY3l3qOjjJqGs4Ks0zMcr6LsWdQKdWwNzbdcL6JsmdlzWf1wyF3y8ZH8HbC4XMVSePQt oFlr2OEkd25dCP8CVjasUfgRjGLv3OSd3v84Llgxy4c+2K8wLMEgmFmo7vHKrTXxDL5IreJQhk cO/UOOj3p2+OvA0eQeb33zKhWcJoMFi7U1I4SjOhZhW7R0aCxJxLB8/wH9fgrGiF2GTQ9qhn7C sadRW7nJDtptVo3mlM1WhO3FZRuJ5DHxSbUTGUcU1Vqh20RqZFp4D0g1ro0cyNc8x7cw1Fs5Me pZA= Date: Tue, 1 Oct 2019 21:50:19 +0000 From: Joseph Myers To: Subject: Work around GCC 10 warning regression in string/tester.c Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 string/tester.c contains code that correctly triggers various GCC warnings about dubious uses of string functions (uses that are being deliberately tested there), and duly disables those warnings around the relevant code. A change in GCC mainline resulted in this code failing to compile with a -Warray-bounds error, despite the location with the error having -Warray-bounds already disabled. This has been reported as . Since this doesn't look like being fixed soon, and to keep regression testing with GCC mainline useful rather than potentially covering up other issues that might be appearing, this patch adds -Warray-bounds disabling for a larger region of code that does suffice to avoid the problem warning. This is on the basis that this would be removed if the regression is fixed before GCC 10 is released. Tested with build-many-glibcs.py for aarch64-linux-gnu with GCC mainline. 2019-10-01 Joseph Myers * string/tester.c (test_strncat) [__GNUC_PREREQ (10, 0)]: Ignore -Warray-bounds for more of the function. --- Any comments on either the patch itself or the principle of working around such issues in glibc to allow more effective testing if not fixed quickly in GCC? diff --git a/string/tester.c b/string/tester.c index 24b0dad1cb..9350538996 100644 --- a/string/tester.c +++ b/string/tester.c @@ -359,6 +359,14 @@ test_strncat (void) /* First test it as strcat, with big counts, then test the count mechanism. */ it = "strncat"; +#if __GNUC_PREREQ (10, 0) + DIAG_PUSH_NEEDS_COMMENT; + /* A regression in GCC 10 + , present as + of 2019-10-01, means this warning needs to be disabled around + more code than just the relevant strncat call. */ + DIAG_IGNORE_NEEDS_COMMENT (8, "-Warray-bounds"); +#endif (void) strcpy (one, "ijk"); DIAG_PUSH_NEEDS_COMMENT; #if __GNUC_PREREQ (7, 0) @@ -394,6 +402,10 @@ test_strncat (void) DIAG_IGNORE_NEEDS_COMMENT (8, "-Warray-bounds"); (void) strncat (one, two, 99); DIAG_POP_NEEDS_COMMENT; +#if __GNUC_PREREQ (10, 0) + /* See the comment above about a regression in GCC 10. */ + DIAG_POP_NEEDS_COMMENT; +#endif equal (one, "ghef", 5); /* Basic test encore. */ equal (two, "ef", 6); /* Stomped on source? */