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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
   Last reconfirmed|                            |2021-08-12
             Blocks|                            |88443
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
Below is a further simplified test case.  The code in
initialize_argument_information() that computes the sizes of actual arguments
to array parameters and issues a warning if the former is less than expected
doesn't consider the implicit pointer argument passed to functions that return
structs by value.  It's off by one for those.

$ cat t.c && gcc -S -Wall t.c
struct A { int a[5]; };

struct A g (int*, int[6][8]);

struct A f (void)
{
  int a[2];
  return g (a, 0);
}

t.c: In function ‘f’:
t.c:8:10: warning: ‘g’ accessing 192 bytes in a region of size 8
[-Wstringop-overflow=]
    8 |   return g (a, 0);
      |          ^~~~~~~~
t.c:8:10: note: referencing argument 2 of type ‘int (*)[8]’
t.c:3:10: note: in a call to function ‘g’
    3 | struct A g (int*, int[6][8]);
      |          ^


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
[Bug 88443] [meta-bug] bogus/missing -Wstringop-overflow warnings

Reply via email to