U
U
User7002020-05-15 23:00:12
GCC
User700, 2020-05-15 23:00:12

How to force GCC to not use SSE aligned instructions for operands on the stack?

When using the GCC 5.1.0 compiler (32bits Windows, TDM GCC compiler) to compile a dll library with SSE optimizations enabled, a SEGFAULT error occurs (reference to 0xffffffff). I found out that the error is related to instructions like:
movaps %xmm0,0x50(%esp)
movaps %xmm0,-0x10(%ebp
) while the stack parameters, and hence esp, ebp are not aligned on the 16-byte boundary (probably when called from the main module), then an error occurs. One would have to use movups for unaligned data. How can this be achieved? What could be the problem? Is there some setting to use only movups instead of movaps; perhaps there are other instructions that access unaligned data. Enabling SSE optimizations when linking the main module had no effect.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-05-16
@User700

It would be more logical to use the -mstackrealign option to align the stack at the entrance to the function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question