public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/97391] New: [11 Regression] bogus -Warray-bounds accessing a multidimensional array parameter
Date: Mon, 12 Oct 2020 22:12:12 +0000	[thread overview]
Message-ID: <bug-97391-4@http.gcc.gnu.org/bugzilla/> (raw)

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;
      |       ~~~~~~~~^~~

             reply	other threads:[~2020-10-12 22:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 22:12 msebor at gcc dot gnu.org [this message]
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

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