[pcre-dev] [Bug 1861] [PATCH] ubsan reports various aligned …

Páxina inicial
Borrar esta mensaxe
Autor: admin
Data:  
Para: pcre-dev
Asunto: [pcre-dev] [Bug 1861] [PATCH] ubsan reports various aligned stores in sljit
https://bugs.exim.org/show_bug.cgi?id=1861

--- Comment #4 from Marc Mutz <marc.mutz@???> ---
> This unaligned access is perfectly fine on x86 specific code.


As I wrote in the commit message, it is not. If you're programming in
assembler, sure, it is, but in C, you're not programming an x86, but the C
abstract machine, and the compiler is allowed to assume (and does assume, ask
the Linux kernel guys) that UB doesn't happen, and optimise accordingly.

> Perhaps the performance cost is not that high, so it could be changed.


Any decent compiler will compile this to the exact same asm sequence than the
old code with optimisation enabled. Verified for GCC using similar fixes in Qt.

> I would not add a macro function though, just call memcpy directly.


Are you talking about SLJIT_MEMCPY? I was jut following SLJIT_MEMMOVE. Why
should memcpy be different?

E.g. some people swear that you need to use __builtin_memcpy to avoid a
function call in debug mode. I don't care about performance in debug mode, and
when I do, I add -O -g, but those people that do can define SLJIT_MEMCPY to
__builtin_memcpy.

--
You are receiving this mail because:
You are on the CC list for the bug.