memccpy()
#78Description
The change I authored, commit de00119, which was recently merged to fix building on BSD based systems like macOS only works when using gcc
to do the compilation. If you instead use the clang
compiler provided by Apple it fails because the BSD
preprocessor symbol isn't defined. You also need to blacklist __APPLE__
.
But here's the thing, the code before my change began with this preprocessor directive:
#if _lib_memccpy && !__ia64 /* these guys may never get it right */
The problem is that assertion is wrong. It implies that the libc implementation of memccpy()
on IA64 is broken. Which is incorrect. The problem is the AST sfputr()
function is depending on what is explicitly undefined behavior in the face of overlapping source and destination buffers. Every implementation is free to optimize the operation by assuming the buffers do not overlap but in so doing produce incorrect results, including aborting the program, if the buffers do overlap.
I was too timid with my previous change. I should not have added another blacklisted architecture. Instead the use of memccpy()
should simply be removed. If you look at the two alternatives using memccpy()
simply complicates the code and is unlikely to be measurably, let alone noticeably, faster.