public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: H.J. Lu <hjl@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] elf: Silence GCC 11/12 false positive warning
Date: Fri, 17 Jun 2022 22:18:45 +0000 (GMT)	[thread overview]
Message-ID: <20220617221845.DCFBA3857B97@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=33ead027586c3371e6765f9070b9564a5ba7e89d

commit 33ead027586c3371e6765f9070b9564a5ba7e89d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 16 18:52:02 2022 -0700

    elf: Silence GCC 11/12 false positive warning
    
    Silence GCC 11/12 false positive warning with -mavx512f on dl-load.c:
    
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106008
    
    $ gcc -O2 -fPIC -march=x86-64 -mavx512f -S -Wall ...
    dl-load.c: In function ‘_dl_map_object_from_fd.constprop’:
    dl-load.c:1158:30: warning: ‘(((char *)loadcmds.113_68 + _933 + 16))[329406144173384849].mapend’ may be used uninitialized [-Wmaybe-uninitialized]

Diff:
---
 elf/dl-load.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 2e4a010fc5..1ad0868dad 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1152,10 +1152,20 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
 	    p_align_max = ph->p_align;
 	  c->mapoff = ALIGN_DOWN (ph->p_offset, GLRO(dl_pagesize));
 
+	  DIAG_PUSH_NEEDS_COMMENT;
+
+#if __GNUC_PREREQ (11, 0)
+	  /* Suppress invalid GCC warning:
+	     ‘(((char *)loadcmds.113_68 + _933 + 16))[329406144173384849].mapend’ may be used uninitialized [-Wmaybe-uninitialized]
+	     See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106008
+	   */
+	  DIAG_IGNORE_NEEDS_COMMENT (11, "-Wmaybe-uninitialized");
+#endif
 	  /* Determine whether there is a gap between the last segment
 	     and this one.  */
 	  if (nloadcmds > 1 && c[-1].mapend != c->mapstart)
 	    has_holes = true;
+	  DIAG_POP_NEEDS_COMMENT;
 
 	  /* Optimize a common case.  */
 #if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7


                 reply	other threads:[~2022-06-17 22:18 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=20220617221845.DCFBA3857B97@sourceware.org \
    --to=hjl@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: link
Be 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).