I found a very strange behaviour when using gcc’s -O3 or -O2 option.
When my program is running under debug mode (-g), it is fine; but it raises a segmentation fault when I turned on -O3 or -O2.
The segmentation happens when it is running a function with SSE2 macro inside; like
_m128i polynomial = _mm_set1_epi8(0x1d)
This is only part of the code.
I think I have already eliminate the situation of address alignment on 16 bytes. It’s so wired that the -g mode and the -O2 or -O3 mode behaves differently.
Actually, I am not sure the bug is related to SSE2 or not.
I am using gcc 4.4.3.
Have you encountered the same problem?
Or can you gave me some suggestion on how to deal with it?
http://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&resolution=FIXED&target_milestone=4.4.4
Update to a newer version of GCC.