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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |9.0
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.0
      Known to fail|                            |7.3.0, 8.2.0

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 9 diagnoses both calls with -Warray-bounds.  With it disabled, it then
issues the expected -Wstringop-overflow:

$ gcc -O2 -S -Wno-array-bounds t.c t.c: In function ‘f’:
t.c:7:3: warning: ‘memcpy’ writing 8 bytes into a region of size 3 overflows
the destination [-Wstringop-overflow=]
    7 |   memcpy (d, "0123456789", 8);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
t.c: In function ‘g’:
t.c:12:3: warning: ‘memcpy’ writing 8 bytes into a region of size 3 overflows
the destination [-Wstringop-overflow=]
   12 |   memcpy (d, s, 8);
      |   ^~~~~~~~~~~~~~~~

This was fixed for GCC 9 in r268037.

Reply via email to