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

2017-11-22 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83108

--- Comment #4 from Markus Trippelsdorf  ---
(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).

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

2017-11-22 Thread gcc-bugspam at coralbark dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83108

--- Comment #3 from Jon Levell  ---
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?

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

2017-11-22 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83108

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||trippels at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #2 from Markus Trippelsdorf  ---
unsigned __int128 always needs 16 byte alignement, otherwise you are invoking
undefined behavior.

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

2017-11-22 Thread gcc-bugspam at coralbark dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83108

--- Comment #1 from Jon Levell  ---
Created attachment 42682
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42682=edit
Plain source file