public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] string: Fix tester build with fortify enable with gcc 6 Date: Wed, 26 Jul 2023 14:22:26 +0000 (GMT) [thread overview] Message-ID: <20230726142226.1C024385773C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=784ae968113011ce832b1808d4d42369f5d2e320 commit 784ae968113011ce832b1808d4d42369f5d2e320 Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Date: Tue Jul 25 12:16:41 2023 -0300 string: Fix tester build with fortify enable with gcc 6 When building with fortify enabled, GCC 6 issues an warning the fortify wrapper might overflow the destination buffer. However, GCC does not provide a specific flag to disable the warning (the failure is tied to -Werror). So to avoid disable all errors, only enable the check for GCC 7 or newer. Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Diff: --- string/tester.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/string/tester.c b/string/tester.c index da42c72141..f7d4bac5a8 100644 --- a/string/tester.c +++ b/string/tester.c @@ -385,8 +385,17 @@ test_strncat (void) (void) strcpy (one, "gh"); (void) strcpy (two, "ef"); + /* When building with fortify enabled, GCC 6 issues an warning the fortify + wrapper might overflow the destination buffer. However, GCC does not + provide a specific flag to disable the warning (the failure is tied to + -Werror). So to avoid disable all errors, only enable the check for + GCC 7 or newer. */ +#if __GNUC_PREREQ (7, 0) (void) strncat (one, two, 99); equal (one, "ghef", 5); /* Basic test encore. */ +#else + equal (one, "gh", 2); +#endif equal (two, "ef", 6); /* Stomped on source? */ (void) strcpy (one, "");
reply other threads:[~2023-07-26 14:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230726142226.1C024385773C@sourceware.org \ --to=azanella@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).