public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/97391] New: [11 Regression] bogus -Warray-bounds accessing a multidimensional array parameter
@ 2020-10-12 22:12 msebor at gcc dot gnu.org
  2020-10-12 22:12 ` [Bug middle-end/97391] " msebor at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-10-12 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97391
           Summary: [11 Regression] bogus -Warray-bounds accessing a
                    multidimensional array parameter
           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: ---

Both warnings below are incorrect.

$ cat xx.c && gcc -O2 -S -Wall xx.c
void f (char a[3][5])
{
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 5; j++)
      a[i][j] = 0;
}
xx.c: In function ‘f’:
xx.c:5:8: warning: array subscript ‘char[5][0]’ is partly outside array bounds
of ‘char[3]’ [-Warray-bounds]
    5 |       a[i][j] = 0;
      |       ~^~~
xx.c:1:14: note: while referencing ‘a’
    1 | void f (char a[3][5])
      |         ~~~~~^~~~~~~
xx.c:5:15: warning: ‘__builtin_memset’ forming offset [3, 14] is out of the
bounds [0, 3] [-Warray-bounds]
    5 |       a[i][j] = 0;
      |       ~~~~~~~~^~~

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

end of thread, other threads:[~2020-10-14 21:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 22:12 [Bug middle-end/97391] New: [11 Regression] bogus -Warray-bounds accessing a multidimensional array parameter msebor at gcc dot gnu.org
2020-10-12 22:12 ` [Bug middle-end/97391] " msebor at gcc dot gnu.org
2020-10-13  6:24 ` rguenth at gcc dot gnu.org
2020-10-14 21:37 ` cvs-commit at gcc dot gnu.org
2020-10-14 21:38 ` 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).