public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/106008] New: [12 Regression] warning: ‘(((char *)loadcmds.113_68 + _933 + 16))[329406144173384849].mapend’ may be used uninitialized [-Wmaybe-uninitialized]
@ 2022-06-16 19:16 hjl.tools at gmail dot com
  2022-06-16 22:27 ` [Bug middle-end/106008] " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2022-06-16 19:16 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-29 10:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 19:16 [Bug middle-end/106008] New: [12 Regression] warning: ‘(((char *)loadcmds.113_68 + _933 + 16))[329406144173384849].mapend’ may be used uninitialized [-Wmaybe-uninitialized] hjl.tools at gmail dot com
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

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).