* [PATCH v2] string: Fix tester build with fortify enable with gcc < 12
@ 2023-08-11 15:38 bmahi496
2023-08-15 11:19 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 2+ messages in thread
From: bmahi496 @ 2023-08-11 15:38 UTC (permalink / raw)
To: libc-alpha; +Cc: rajis, joseph, Mahesh Bodapati
From: Mahesh Bodapati <bmahi496@linux.ibm.com>
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.
---
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 <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)
--
2.39.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] string: Fix tester build with fortify enable with gcc < 12
2023-08-11 15:38 [PATCH v2] string: Fix tester build with fortify enable with gcc < 12 bmahi496
@ 2023-08-15 11:19 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella Netto @ 2023-08-15 11:19 UTC (permalink / raw)
To: bmahi496, libc-alpha; +Cc: rajis, joseph
On 11/08/23 12:38, bmahi496--- via Libc-alpha wrote:
> From: Mahesh Bodapati <bmahi496@linux.ibm.com>
>
> 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.
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> 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 <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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-15 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11 15:38 [PATCH v2] string: Fix tester build with fortify enable with gcc < 12 bmahi496
2023-08-15 11:19 ` Adhemerval Zanella Netto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).