public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs
@ 2021-03-08 22:32 msebor at gcc dot gnu.org
  2021-03-08 22:34 ` [Bug tree-optimization/99475] " msebor at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-08 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99475
           Summary: [10/11 Regression] bogus -Warray-bounds accessing an
                    array element of empty structs
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

An indirect access to an element of an array of empty structs through a pointer
to such an element triggers a spurious -Warray-bounds warning:

$ cat v.c && gcc -O2 -S -Wall v.c
struct S { } a[5];

void f (void)
{
  a[1] = (struct S) { };   // okay
}

void g (void)
{
  struct S *p = &a[0];
  p[1] = (struct S) { };   // bogus -Warray-bounds
}

v.c: In function ‘g’:
v.c:11:4: warning: array subscript 0 is outside array bounds of ‘struct S[5]’
[-Warray-bounds]
   11 |   p[1] = (struct S) { };
      |   ~^~~
v.c:1:14: note: while referencing ‘a’
    1 | struct S { } a[5];
      |              ^

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

* [Bug tree-optimization/99475] [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
@ 2021-03-08 22:34 ` msebor at gcc dot gnu.org
  2021-03-09  2:40 ` msebor at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-08 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.2.0, 11.0
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |9.3.0
             Blocks|                            |56456
   Last reconfirmed|                            |2021-03-08
           Keywords|                            |diagnostic
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Bisection points to commit d893b683f40884cd00b5beb392566ecc7b67f721:

Author: Martin Sebor <msebor@redhat.com>
Date:   Thu Jul 19 23:36:34 2018 +0000

    PR tree-optimization/84047 - missing -Warray-bounds on an out-of-bounds
index into an array

    PR tree-optimization/84047 - missing -Warray-bounds on an out-of-bounds
index into an array
    PR tree-optimization/83776 - missing -Warray-bounds indexing past the end
of a string literal

    gcc/ChangeLog:

            PR tree-optimization/84047
            PR tree-optimization/83776
            * tree-vrp.c (vrp_prop::check_mem_ref): New function.
            (check_array_bounds): Call it.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/83776
            PR tree-optimization/84047
            * gcc.dg/Warray-bounds-29.c: New test.
            * gcc.dg/Warray-bounds-30.c: New test.
            * gcc.dg/Warray-bounds-31.c: New test.
            * gcc.dg/Warray-bounds-32.c: New test.

    From-SVN: r262893


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] 10+ messages in thread

* [Bug tree-optimization/99475] [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
  2021-03-08 22:34 ` [Bug tree-optimization/99475] " msebor at gcc dot gnu.org
@ 2021-03-09  2:40 ` msebor at gcc dot gnu.org
  2021-03-09  8:32 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-09  2:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566450.html

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

* [Bug tree-optimization/99475] [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
  2021-03-08 22:34 ` [Bug tree-optimization/99475] " msebor at gcc dot gnu.org
  2021-03-09  2:40 ` msebor at gcc dot gnu.org
@ 2021-03-09  8:32 ` rguenth at gcc dot gnu.org
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-09  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Target Milestone|---                         |10.3

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

* [Bug tree-optimization/99475] [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-09  8:32 ` rguenth at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2022-03-17 19:41 ` msebor at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.3                        |10.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

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

* [Bug tree-optimization/99475] [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2022-03-17 19:41 ` msebor at gcc dot gnu.org
  2022-06-28 10:43 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-03-17 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|msebor at gcc dot gnu.org          |unassigned at gcc dot gnu.org
            Summary|[10/11/12 Regression] bogus |[10/11 Regression] bogus
                   |-Warray-bounds accessing an |-Warray-bounds accessing an
                   |array element of empty      |array element of empty
                   |structs                     |structs
      Known to work|                            |12.0
             Status|ASSIGNED                    |NEW

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
This has been fixed in GCC 12.  I'm not planning to backport it.

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

* [Bug tree-optimization/99475] [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-03-17 19:41 ` msebor at gcc dot gnu.org
@ 2022-06-28 10:43 ` jakub at gcc dot gnu.org
  2023-07-07 10:39 ` [Bug tree-optimization/99475] [11 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug tree-optimization/99475] [11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-06-28 10:43 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:39 ` rguenth at gcc dot gnu.org
  2024-04-26 18:21 ` siddhesh at gcc dot gnu.org
  2024-05-04  7:42 ` egallager at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

* [Bug tree-optimization/99475] [11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-07-07 10:39 ` [Bug tree-optimization/99475] [11 " rguenth at gcc dot gnu.org
@ 2024-04-26 18:21 ` siddhesh at gcc dot gnu.org
  2024-05-04  7:42 ` egallager at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: siddhesh at gcc dot gnu.org @ 2024-04-26 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siddhesh at gcc dot gnu.org

--- Comment #7 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> ---
This doesn't appear to be reproducible on trunk anymore, should we close it?

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

* [Bug tree-optimization/99475] [11 Regression] bogus -Warray-bounds accessing an array element of empty structs
  2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-04-26 18:21 ` siddhesh at gcc dot gnu.org
@ 2024-05-04  7:42 ` egallager at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: egallager at gcc dot gnu.org @ 2024-05-04  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection

--- Comment #8 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Siddhesh Poyarekar from comment #7)
> This doesn't appear to be reproducible on trunk anymore, should we close it?

Might be worth bisecting to find out when exactly it was fixed, but I'll leave
that decision up to someone else to make...

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

end of thread, other threads:[~2024-05-04  7:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 22:32 [Bug tree-optimization/99475] New: [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs msebor at gcc dot gnu.org
2021-03-08 22:34 ` [Bug tree-optimization/99475] " msebor at gcc dot gnu.org
2021-03-09  2:40 ` msebor at gcc dot gnu.org
2021-03-09  8:32 ` rguenth at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2022-03-17 19:41 ` msebor at gcc dot gnu.org
2022-06-28 10:43 ` jakub at gcc dot gnu.org
2023-07-07 10:39 ` [Bug tree-optimization/99475] [11 " rguenth at gcc dot gnu.org
2024-04-26 18:21 ` siddhesh at gcc dot gnu.org
2024-05-04  7:42 ` egallager 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).