code below produces "memcpy" invocation for wrong_1 and wrong_2 procedures, only
ok procedure hets "memcpy" optimized properly.
Both wrong_1 and wrong_2 should compile to identical code equal to code of "ok".
--begin code--
include <string.h>
char *b;
struct W {
inline static void wr(char *buf, int sz) {
::memcpy(b, buf, sz);
b += sz;
}
inline static void wr(char c) { wr(&c, sizeof(c)); }
};
int wrong_1(char c) { W::wr(&c, 1); }
int wrong_2(char c) { W::wr(c); }
int ok(char c) { ::memcpy(b, &c, 1); }
--end code--
--
Summary: missed optimization: memcpy is invoked with small size
known upfront if invoked through inlined function(s)
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yuri at tsoft dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19943