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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |10.0
      Known to fail|                            |8.3.0, 9.2.0
      Known to work|                            |10.0
         Resolution|---                         |FIXED

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in GCC 10 via r279248 which now prints:

pr92307.c: In function ‘f’:
pr92307.c:2:3: warning: writing 2 bytes into a region of size 1
[-Wstringop-overflow=]
    2 |   __builtin_memcpy (d, s, n)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
pr92307.c:10:3: note: in expansion of macro ‘memcpy’
   10 |   memcpy (p, s, 2);   // writing before the beginning of a
      |   ^~~~~~
pr92307.c:4:6: note: at offset 0 to object ‘a’ with size 2 declared here
    4 | char a[2];
      |      ^
pr92307.c: In function ‘g’:
pr92307.c:2:3: warning: writing 2 bytes into a region of size 0
[-Wstringop-overflow=]
    2 |   __builtin_memcpy (d, s, n)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
pr92307.c:17:3: note: in expansion of macro ‘memcpy’
   17 |   memcpy (p, s, 2);   // writing past the end of a
      |   ^~~~~~
pr92307.c:4:6: note: at offset 0 to object ‘a’ with size 2 declared here
    4 | char a[2];
      |      ^

Reply via email to