I use __int128
as struct's member.
It works find with -O0
(no optimization).
However it crashes for segment fault if optimization enabled (-O1
).
It crashes at instruction movdqa
, which need the var aligned by 16.
While the address is allocated by malloc()
which align only by 8.
I tried to disable SSE optimization by -mno-sse
, but it fails to compile:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:27:1: error: SSE register return with SSE disabled
So what can I do if I want to use __int128
and -O1
both?
Thanks in advance Wu
BTW, it seems OK if __int128
is used only on stack (not on heap).
==== EDIT ====
Sorry that I did not say the truth.
In fact I did not use malloc()
. I used a memory pool lib which returns address aligned by 8.
I said malloc()
just to want to make things simple.
After testing, I have known that malloc()
aligns by 16. And the __int128
member also align by 16 in struct.
So the problem is my memory pool lib only.
Thanks very much.