public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "harald at gigawatt dot nl" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug web/61054] New: Clearly note effect of memcpy optimization improvements in 4.9 changes Date: Sun, 04 May 2014 12:57:00 -0000 [thread overview] Message-ID: <bug-61054-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61054 Bug ID: 61054 Summary: Clearly note effect of memcpy optimization improvements in 4.9 changes Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: web Assignee: unassigned at gcc dot gnu.org Reporter: harald at gigawatt dot nl Consider this reduced program: void *volatile null; volatile long zerolen; int main() { void *dst = null, *src = null; __builtin_memcpy (dst, src, zerolen); if (dst) __builtin_abort (); } This program is invalid, but until 4.8 it would compile and run without an issue. As of 4.9, it aborts. I'm not asking for GCC to change (the programs should be fixed instead), but it is not clear from the GCC 4.9 Changes page that such code no longer works. This affects real code using custom allocators and realloc-like functions, where some of those realloc-like functions don't bother to check for null pointers and assume zero-length memcpy is a no-op. When the old memory is then freed, and their free-like function performs a null pointer check, that check is optimised away if the function gets inlined. Could the GCC 4.9 Changes page get a mention of this? I do see "Better inlining of memcpy and memset that is aware of value ranges and produces shorter alignment prologues." in the IA-32/x86-64 section, but I cannot tell if it is related to that, or if it is actually arch-independent.
next reply other threads:[~2014-05-04 12:57 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-05-04 12:57 harald at gigawatt dot nl [this message] 2014-05-04 13:52 ` [Bug web/61054] " redi at gcc dot gnu.org 2014-05-04 14:06 ` harald at gigawatt dot nl 2014-05-04 15:54 ` redi at gcc dot gnu.org
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-61054-4@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).