public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Joseph Myers <jsm28@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] Disable spurious -Warray-bounds for ypclnt.c (bug 26687) Date: Fri, 30 Oct 2020 21:40:59 +0000 (GMT) [thread overview] Message-ID: <20201030214059.4303E383E809@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=882774658cb8daee4c16677a3fd674f6052cc157 commit 882774658cb8daee4c16677a3fd674f6052cc157 Author: Joseph Myers <joseph@codesourcery.com> Date: Fri Oct 30 21:40:25 2020 +0000 Disable spurious -Warray-bounds for ypclnt.c (bug 26687) Included among the GCC 11 warnings listed in bug 26687, but not fixed when that bug was marked as FIXED, are -Warray-bounds warnings in nis/ypclnt.c. These are all for different calls to the same piece of code, which already has a comment explaining that the element accessed is in a common prefix of the various structures. On the basis of that comment, this patch treats the warning as a false positive and disables it for that code. Tested with build-many-glibcs.py for arm-linux-gnueabi, where, together with my previous two patches, this allows the build of glibc to complete with GCC 11 (further build failures appear in the testsuite). Reviewed-by: DJ Delorie <dj@redhat.com> Diff: --- nis/ypclnt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nis/ypclnt.c b/nis/ypclnt.c index ada08bf982..898f8143e9 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -30,6 +30,7 @@ #include <sys/uio.h> #include <libc-lock.h> #include <shlib-compat.h> +#include <libc-diag.h> /* This should only be defined on systems with a BSD compatible ypbind */ #ifndef BINDINGDIR @@ -368,12 +369,19 @@ do_ypcall_tr (const char *domain, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp) { int status = do_ypcall (domain, prog, xargs, req, xres, resp); + DIAG_PUSH_NEEDS_COMMENT; + /* This cast results in a warning that a ypresp_val is partly + outside the bounds of the actual object referenced, but as + explained below only the stat element (in a common prefix) is + accessed. */ + DIAG_IGNORE_NEEDS_COMMENT (11, "-Warray-bounds"); if (status == YPERR_SUCCESS) /* We cast to ypresp_val although the pointer could also be of type ypresp_key_val or ypresp_master or ypresp_order or ypresp_maplist. But the stat element is in a common prefix so this does not matter. */ status = ypprot_err (((struct ypresp_val *) resp)->stat); + DIAG_POP_NEEDS_COMMENT; return status; }
reply other threads:[~2020-10-30 21:40 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=20201030214059.4303E383E809@sourceware.org \ --to=jsm28@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).