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: unassig...@gcc.gnu.org ReportedBy: dcb...@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 ?