public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug other/54800] New: libiberty/simple-object-mach-o.c:704: possible optimisation ? Date: Wed, 03 Oct 2012 21:21:00 -0000 [thread overview] Message-ID: <bug-54800-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54800 Bug #: 54800 Summary: libiberty/simple-object-mach-o.c:704: possible optimisation ? Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: other AssignedTo: unassigned@gcc.gnu.org ReportedBy: dcb314@hotmail.com I just tried the latest cppcheck over the source code of trunk and it said [trunk/libiberty/simple-object-mach-o.c:704] -> [trunk/libiberty/simple-object-mach-o.c:705]: (performance) Buffer 'namebuf' is being written before its old content has been used. The source code is memset (namebuf, 0, MACH_O_NAME_LEN * 2 + 2); memcpy (namebuf, (char *) sechdr + segname_offset, MACH_O_NAME_LEN); Maybe something like memcpy (namebuf, (char *) sechdr + segname_offset, MACH_O_NAME_LEN); memset (&namebuf[MACH_O_NAME_LEN], MACH_O_NAME_LEN + 2); might be faster and simpler ?
next reply other threads:[~2012-10-03 21:21 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-10-03 21:21 dcb314 at hotmail dot com [this message] 2012-10-03 21:22 ` [Bug other/54800] " dcb314 at hotmail dot com 2013-01-01 16:34 ` ian at airs dot com 2013-01-04 18:36 ` iains at gcc dot gnu.org 2013-01-04 19:00 ` ian at gcc dot gnu.org 2013-01-04 19:01 ` ian at airs dot com
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-54800-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).