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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|tree-optimization           |middle-end
      Known to work|                            |10.0
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot 
gnu.org
   Target Milestone|---                         |10.0
      Known to fail|                            |7.3.0, 8.3.0, 9.2.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
This is now diagnosed thanks to r273783 as follows:

$ cat pr89427.c && gcc -O2 -S -Wall pr89427.c
char a[8];

void f (int i)
{
  char *p = a + sizeof a;
  if (i < 5)
    i = 5;
  p[i] = 0;   // missing -Warray-bounds
}
pr89427.c: In function ‘f’:
pr89427.c:8:8: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
    8 |   p[i] = 0;   // missing -Warray-bounds
      |   ~~~~~^~~
pr89427.c:1:6: note: destination object declared here
    1 | char a[8];
      |      ^

Reply via email to