From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id AD7F73858C60 for ; Fri, 15 Sep 2023 22:02:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD7F73858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= To: libc-stable@sourceware.org Cc: Mahesh Bodapati , Adhemerval Zanella Subject: [PATCH 2/3] string: Fix tester build with fortify enable with gcc < 12 Date: Sat, 16 Sep 2023 00:01:28 +0200 Message-ID: <20230915220242.2825510-3-dilfridge@gentoo.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915220242.2825510-1-dilfridge@gentoo.org> References: <20230915220242.2825510-1-dilfridge@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Mahesh Bodapati When building with fortify enabled, GCC < 12 issues a warning on the fortify strncat wrapper might overflow the destination buffer (the failure is tied to -Werror). Checked on ppc64 and x86_64. Reviewed-by: Adhemerval Zanella (cherry picked from commit f1c7ed0859a45929136836341741c7cd70f428cb) --- string/tester.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/string/tester.c b/string/tester.c index f7d4bac5a8..824cf315ff 100644 --- a/string/tester.c +++ b/string/tester.c @@ -34,6 +34,14 @@ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation"); #endif +/* When building with fortify enabled, GCC < 12 issues a warning on the + fortify strncat wrapper might overflow the destination buffer (the + failure is tied to -Werror). + Triggered by strncat fortify wrapper when it is enabled. */ +#if __GNUC_PREREQ (11, 0) +DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread"); +#endif + #include #include #include @@ -52,9 +60,6 @@ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args"); DIAG_IGNORE_NEEDS_COMMENT (9, "-Wrestrict"); DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow="); #endif -#if __GNUC_PREREQ (11, 0) -DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread"); -#endif #define STREQ(a, b) (strcmp((a), (b)) == 0) -- 2.41.0