[Bug c/83108] Unaligned 128bit dereference causes segfault with -O2 on x86-64

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 22 15:39:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83108

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Jon Levell from comment #3)
> I'm surprised this was closed invalid.
> 
> "While the x86 architecture originally did not require aligned memory
> access, and still works without it, some SSE2 instructions on x86 CPUs do
> require the data to be 128-bit (16-byte) aligned"
> 
> I'm not doing anything SSE2 related. I'm surprised this is considered
> undefined behaviour?

It has nothing to do with SSE2. GCC simply assumes that __uint128_t is
16byte alignmented and optimizes accordingly (clang does the same).


More information about the Gcc-bugs mailing list