public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/98583] New: missing -Wuninitialized reading from a second VLA in its own block
@ 2021-01-07 16:20 msebor at gcc dot gnu.org
  2021-01-08  8:28 ` [Bug middle-end/98583] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-01-07 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98583
           Summary: missing -Wuninitialized reading from a second VLA in
                    its own block
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC diagnoses the uninitialized accessed in h1() but if fails to detect the
same invalid access in h2().

$ cat x.c && gcc -O2 -S -Wall x.c
void f (int*);
void g (int);

void h1 (int n)
{
  int a[n];
  f (a);

  int b[n];
  g (b[1]);        // -Wuninitialized (good)
}

void h2 (int n, int i, int j)
{
  if (i)   // ditto without this if...
    {
      int a[n];
      f (a);
    }

  if (j)   // ...or this if...
    {
      int b[n];
      g (b[1]);    // missing warning
    }
}

x.c: In function ‘h1’:
x.c:10:3: warning: ‘*b[1]’ is used uninitialized [-Wuninitialized]
   10 |   g (b[1]);        // -Wuninitialized (good)
      |   ^~~~~~~~

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

end of thread, other threads:[~2021-05-13 22:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 16:20 [Bug middle-end/98583] New: missing -Wuninitialized reading from a second VLA in its own block msebor at gcc dot gnu.org
2021-01-08  8:28 ` [Bug middle-end/98583] " rguenth at gcc dot gnu.org
2021-05-11 19:51 ` msebor at gcc dot gnu.org
2021-05-13 22:07 ` cvs-commit at gcc dot gnu.org
2021-05-13 22:40 ` msebor 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).