public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/92307] missing -Wstringop-overflow on a memcpy into an array with out-of-bounds variable offset Date: Mon, 13 Apr 2020 21:38:12 +0000 [thread overview] Message-ID: <bug-92307-4-4oOBrYyZ6J@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-92307-4@http.gcc.gnu.org/bugzilla/> 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]; | ^
parent reply other threads:[~2020-04-13 21:38 UTC|newest] Thread overview: expand[flat|nested] mbox.gz Atom feed [parent not found: <bug-92307-4@http.gcc.gnu.org/bugzilla/>]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-92307-4-4oOBrYyZ6J@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).