Mario Charest
07/25/2010 9:20 AM
post60527
|
I`ve rebuild all project with 4.4.2 (6.5.0) and one of our program is doing a SIGSEGV. I traced the problem to the
following code (simplified)
int map[256];
for ( int i=0; i<256;++i)
map[i];
Seems simple enough right? The compiler optimisizes this code to use xmm0 register to fill out the map array. The
xxm0 register being16 bytes the loop is 4 time shorter. That makes sense. The problem with this is for the instruction
moveaps xmm0,(%eax) to work eax must point to a 16 bytes aligned memory adress, and it's not.... That is what causes
the SIGSEGV.
Looking at the assembly code, there is nothing that check if the data is align. The fonction assumes, upon entry, that
the stack is already 16-byte aligned.
Note that the crash appears in thread 3, the same fonction called from thread 1 is not causing any issue.
What did I miss?
|
|
|