Open GoogleCodeExporter opened 9 years ago
> while (scan < safe_end && *((size_t*)scan) == *((size_t*)match)) {
If scan is not integer aligned, then that will cause unaligned accesses. In
x86, this is a performance problem. In other architectures, it results in a
SIGBUS like you are seeing.
It seems to me that there should be a bit of code before the while loop that
advances scan up to the next alignment boundary, like you find in optimized
memcmp implementations. Once scan is aligned, then the optimized loops (for 8
and 4 bytes) can be used.
Original comment by jeff.al...@gmail.com
on 10 Jan 2014 at 12:56
Compiling with -fsanitize=undefined
results in runtime errors for these unaligned reads. I believe it could also potentially be violating the strict aliasing rule.
Original issue reported on code.google.com by
tso...@gmail.com
on 22 Jun 2013 at 11:37