From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1969) id 942D93858401; Fri, 18 Aug 2023 13:00:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 942D93858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692363631; bh=MlkNWv2/sXoOQ9ukLBRJ2CLmDU5mh85t3uCbzhdekHI=; h=From:To:Subject:Date:From; b=IDUWb8IbTlRd+AFyeZpK4TbAsO3NPqh/R/dP3hSG25P3Jfhis69YZLlgJNVbk3dkb 7v3ojrvQurG/14M7FP+h7WocPIOg76z+cH64fD3JpLocUeGQK+I0Qmr/d3w8xmJaHt NvKPnvWYcH1HO05b8rbudW9u5id7DtmoTuFOb44I= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Rajalakshmi Srinivasaraghavan To: glibc-cvs@sourceware.org Subject: [glibc] string: Fix tester build with fortify enable with gcc < 12 X-Act-Checkin: glibc X-Git-Author: Mahesh Bodapati X-Git-Refname: refs/heads/master X-Git-Oldrev: f5f96b784beb3480e0e8d10e250ca7e6063ab881 X-Git-Newrev: f1c7ed0859a45929136836341741c7cd70f428cb Message-Id: <20230818130031.942D93858401@sourceware.org> Date: Fri, 18 Aug 2023 13:00:31 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f1c7ed0859a45929136836341741c7cd70f428cb commit f1c7ed0859a45929136836341741c7cd70f428cb Author: Mahesh Bodapati Date: Fri Aug 11 10:38:25 2023 -0500 string: Fix tester build with fortify enable with gcc < 12 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 Diff: --- 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)