public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/92307] missing -Wstringop-overflow on a memcpy into an array with out-of-bounds variable offset
       [not found] <bug-92307-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-13 21:38 ` msebor at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: msebor at gcc dot gnu.org @ 2020-04-13 21:38 UTC (permalink / raw)
  To: gcc-bugs

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];
      |      ^

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-13 21:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-92307-4@http.gcc.gnu.org/bugzilla/>
2020-04-13 21:38 ` [Bug middle-end/92307] missing -Wstringop-overflow on a memcpy into an array with out-of-bounds variable offset msebor at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).