public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/84050] [8/9/10 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-12 11:58 ` jakub at gcc dot gnu.org
  2021-02-13 23:48 ` [Bug tree-optimization/84050] [8/9/10/11 " msebor at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-12 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.3                         |9.4

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 9.3.0 has been released, adjusting target milestone.

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

* [Bug tree-optimization/84050] [8/9/10/11 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
  2020-03-12 11:58 ` [Bug tree-optimization/84050] [8/9/10 Regression] missing -Warray-bounds accessing a struct array member jakub at gcc dot gnu.org
@ 2021-02-13 23:48 ` msebor at gcc dot gnu.org
  2021-02-13 23:49 ` msebor at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-02-13 23:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|10.0                        |10.2.0, 11.0

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Aldy Hernandez from comment #2)
...
> I'm not a language lawyer, so I don't know what the semantics of undefined
> behavior is.  Is returning 0 even the correct thing to do?

Anything goes for undefined behavior so folding the access to zero is strictly
valid.  But doing it silently, without issuing a warning designed to detect
this bug, is at a minimum unfriendly (I'd even say it's a bug in the warning).

I believe the problem is in fold_nonarray_ctor_reference(): the function
doesn't make sure the reference is in bounds of the object.  It simply returns
zero when it isn't om the assumption reflected in a comment removed in r274837:

  /* Memory not explicitly mentioned in constructor is 0.  */

The function assumes that when the constructor is smaller than the type of the
declared object the reference is to an element of the object.  But that's only
true for valid references, not for those that are out of bounds.  So before
returning zero, the function should check that the offset into the object plus
the element size doesn't exceed the size of the object and if it does, return
null.

I suspect a fix wouldn't be considered in stage 4 of GCC 11 but it's something
to look into for GCC 12.

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

* [Bug tree-optimization/84050] [8/9/10/11 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
  2020-03-12 11:58 ` [Bug tree-optimization/84050] [8/9/10 Regression] missing -Warray-bounds accessing a struct array member jakub at gcc dot gnu.org
  2021-02-13 23:48 ` [Bug tree-optimization/84050] [8/9/10/11 " msebor at gcc dot gnu.org
@ 2021-02-13 23:49 ` msebor at gcc dot gnu.org
  2021-06-01  8:09 ` [Bug tree-optimization/84050] [9/10/11/12 " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-02-13 23:49 UTC (permalink / raw)
  To: gcc-bugs

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

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 #8 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'll look into it for GCC 12.

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

* [Bug tree-optimization/84050] [9/10/11/12 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-02-13 23:49 ` msebor at gcc dot gnu.org
@ 2021-06-01  8:09 ` rguenth at gcc dot gnu.org
  2021-09-21  8:13 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug tree-optimization/84050] [9/10/11/12 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-06-01  8:09 ` [Bug tree-optimization/84050] [9/10/11/12 " rguenth at gcc dot gnu.org
@ 2021-09-21  8:13 ` pinskia at gcc dot gnu.org
  2021-09-21  8:13 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-21  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
reduced testcase:
static int b[3] = { 1, 2, 3 };

int fstatic_array (void)
{
  return b[7];   // missing -Warray-bounds
}

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

* [Bug tree-optimization/84050] [9/10/11/12 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-09-21  8:13 ` pinskia at gcc dot gnu.org
@ 2021-09-21  8:13 ` pinskia at gcc dot gnu.org
  2022-03-17 19:31 ` msebor at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-21  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marco.morandini at polimi dot it

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 102422 has been marked as a duplicate of this bug. ***

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

* [Bug tree-optimization/84050] [9/10/11/12 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-09-21  8:13 ` pinskia at gcc dot gnu.org
@ 2022-03-17 19:31 ` msebor at gcc dot gnu.org
  2022-05-27  9:38 ` [Bug tree-optimization/84050] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-03-17 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

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
             Status|ASSIGNED                    |NEW

--- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'm no longer working on this.

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

* [Bug tree-optimization/84050] [10/11/12/13 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-03-17 19:31 ` msebor at gcc dot gnu.org
@ 2022-05-27  9:38 ` rguenth at gcc dot gnu.org
  2022-06-28 10:34 ` jakub at gcc dot gnu.org
  2023-07-07 10:32 ` [Bug tree-optimization/84050] [11/12/13/14 " rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug tree-optimization/84050] [10/11/12/13 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-05-27  9:38 ` [Bug tree-optimization/84050] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:34 ` jakub at gcc dot gnu.org
  2023-07-07 10:32 ` [Bug tree-optimization/84050] [11/12/13/14 " rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #14 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/84050] [11/12/13/14 Regression] missing -Warray-bounds accessing a struct array member
       [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2022-06-28 10:34 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:32 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2023-07-07 10:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-84050-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:58 ` [Bug tree-optimization/84050] [8/9/10 Regression] missing -Warray-bounds accessing a struct array member jakub at gcc dot gnu.org
2021-02-13 23:48 ` [Bug tree-optimization/84050] [8/9/10/11 " msebor at gcc dot gnu.org
2021-02-13 23:49 ` msebor at gcc dot gnu.org
2021-06-01  8:09 ` [Bug tree-optimization/84050] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-09-21  8:13 ` pinskia at gcc dot gnu.org
2021-09-21  8:13 ` pinskia at gcc dot gnu.org
2022-03-17 19:31 ` msebor at gcc dot gnu.org
2022-05-27  9:38 ` [Bug tree-optimization/84050] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:34 ` jakub at gcc dot gnu.org
2023-07-07 10:32 ` [Bug tree-optimization/84050] [11/12/13/14 " rguenth 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).