about summary refs log tree commit diff
path: root/string
diff options
context:
space:
mode:
authorMahesh Bodapati <bmahi496@linux.ibm.com>2023-08-11 10:38:25 -0500
committerRajalakshmi Srinivasaraghavan <raji@Rajalakshmis-MacBook-Pro.local>2023-08-18 07:59:55 -0500
commitf1c7ed0859a45929136836341741c7cd70f428cb (patch)
tree1bb0108bd5a57744676992cda1497c547d7477c9 /string
parentf5f96b784beb3480e0e8d10e250ca7e6063ab881 (diff)
downloadglibc-f1c7ed0859a45929136836341741c7cd70f428cb.tar.gz
glibc-f1c7ed0859a45929136836341741c7cd70f428cb.tar.xz
glibc-f1c7ed0859a45929136836341741c7cd70f428cb.zip
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  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'string')
-rw-r--r--string/tester.c11
1 files 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 <errno.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -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)