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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
          Component|c                           |middle-end
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot 
gnu.org
   Target Milestone|---                         |10.0

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 10.0 (since r277728) issues the following warning for the test case:

$ cat pr87192.c && gcc -O2 -S -Wall pr87192.c

void bar(void *);
void foo()
{
    struct {
        int a[10];
    } s;
    bar(s.a+12);
}
pr87192.c: In function ‘foo’:
pr87192.c:8:5: warning: array subscript 12 is outside array bounds of ‘struct
<anonymous>[1]’ [-Warray-bounds]
    8 |     bar(s.a+12);
      |     ^~~~~~~~~~~
pr87192.c:7:7: note: while referencing ‘s’
    7 |     } s;
      |       ^

Reply via email to