public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/106008] New: [12 Regression] warning: ‘(((char *)loadcmds.113_68 + _933 + 16))[329406144173384849].mapend’ may be used uninitialized [-Wmaybe-uninitialized]
Date: Thu, 16 Jun 2022 19:16:59 +0000	[thread overview]
Message-ID: <bug-106008-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106008

            Bug ID: 106008
           Summary: [12 Regression] warning: ‘(((char *)loadcmds.113_68 +
                    _933 + 16))[329406144173384849].mapend’ may be used
                    uninitialized [-Wmaybe-uninitialized]
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

Created attachment 53156
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53156&action=edit
A testcase

When building glibc master branch with -mavx512f, I got

[hjl@gnu-tgl-2 tmp]$ gcc -O2 -march=x86-64 -S -Wall x.i -mavx512f 
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]
[hjl@gnu-tgl-2 tmp]$ 

The code looks like

          struct loadcmd *c = &loadcmds[nloadcmds++];
          c->mapstart = ALIGN_DOWN (ph->p_vaddr, GLRO(dl_pagesize));
          c->mapend = ALIGN_UP (ph->p_vaddr + ph->p_filesz, GLRO(dl_pagesize));
          c->dataend = ph->p_vaddr + ph->p_filesz;
          c->allocend = ph->p_vaddr + ph->p_memsz;
          /* Remember the maximum p_align.  */
          if (powerof2 (ph->p_align) && ph->p_align > p_align_max)
            p_align_max = ph->p_align;
          c->mapoff = ALIGN_DOWN (ph->p_offset, GLRO(dl_pagesize));

          /* Determine whether there is a gap between the last segment
             and this one.  */
          if (nloadcmds > 1 && c[-1].mapend != c->mapstart)
            has_holes = true;

c[-1].mapend should always be initialized.

             reply	other threads:[~2022-06-16 19:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 19:16 hjl.tools at gmail dot com [this message]
2022-06-16 22:27 ` [Bug middle-end/106008] " hjl.tools at gmail dot com
2022-06-17  2:55 ` [Bug middle-end/106008] [11/12 " hjl.tools at gmail dot com
2022-06-20 10:01 ` [Bug middle-end/106008] [11/12/13 " rguenth at gcc dot gnu.org
2022-06-20 10:01 ` rguenth at gcc dot gnu.org
2023-03-29 13:35 ` rguenth at gcc dot gnu.org
2023-05-29 10:07 ` [Bug middle-end/106008] [11/12/13/14 " jakub at gcc dot gnu.org

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=bug-106008-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).