This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH][AArch64] Optimized memcpy/memmove
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: "'Zack Weinberg'" <zackw at panix dot com>, OndÅej BÃlka <neleai at seznam dot cz>
- Cc: "GNU C Library" <libc-alpha at sourceware dot org>
- Date: Mon, 5 Oct 2015 11:30:15 +0100
- Subject: RE: [PATCH][AArch64] Optimized memcpy/memmove
- Authentication-results: sourceware.org; auth=none
- References: <002901d0f794$66138480$323a8d80$ at com> <20150927084319 dot GA22368 at domone> <003701d0f9d0$fe013470$fa039d50$ at com> <20150930122753 dot GA12909 at domone> <CAKCAbMg7unuoQyPUb0-X3-JZPf+D1YGqf0VtZcsD6x95NRVoPw at mail dot gmail dot com>
> Zack Weinberg wrote:
> Making memcpy the same as memmove is dangerous because then people
> will fail to notice when they *should* have used memmove. If you do
> anything at all, detect an overlap and call abort().
Many memcpy implementations already behave like memmove for sizes smaller
than ~256 bytes, so combining them would not significantly increase the
danger. The behaviour of memcpy on overlaps is undefined, so it's reasonable
to do whatever happens to be fastest and do the additional checks in debug
libraries/sanitizers (oddly enough memcpy_chk does not check for overlaps).
Wilco