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

* [Bug middle-end/97391] [11 Regression] bogus -Warray-bounds accessing a multidimensional array parameter
  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 ` msebor at gcc dot gnu.org
  2020-10-13  6:24 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |56456
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2020-10-12
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Looks like a bug in gimple_parm_array_size() that computes the size of function
array parameters.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
[Bug 56456] [meta-bug] bogus/missing -Warray-bounds

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

* [Bug middle-end/97391] [11 Regression] bogus -Warray-bounds accessing a multidimensional array parameter
  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
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-13  6:24 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0

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

* [Bug middle-end/97391] [11 Regression] bogus -Warray-bounds accessing a multidimensional array parameter
  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
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-14 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:14d83c6f584c321989b43526dc9437de4381aa47

commit r11-3901-g14d83c6f584c321989b43526dc9437de4381aa47
Author: Martin Sebor <msebor@redhat.com>
Date:   Wed Oct 14 15:19:39 2020 -0600

    PR middle-end/97391 - bogus -Warray-bounds accessing a multidimensional
array parameter

    gcc/ChangeLog:

            PR middle-end/97391
            * builtins.c (gimple_parm_array_size): Peel off one less layer
            of array types.

    gcc/testsuite/ChangeLog:

            PR middle-end/97391
            * gcc.dg/Warray-bounds-68.c: New test.

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

* [Bug middle-end/97391] [11 Regression] bogus -Warray-bounds accessing a multidimensional array parameter
  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
                   ` (2 preceding siblings ...)
  2020-10-14 21:37 ` cvs-commit at gcc dot gnu.org
@ 2020-10-14 21:38 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-10-14 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in r11-3901.

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