Tim Prince wrote:
Jonathan Kinsey wrote:
Tim Prince wrote:
I don't remember what was said in the past, but any gcc function which
uses SSE parallel instructions must be called from a gcc function which
passes a 16-byte aligned stack. So you may be able to overcome it by
interposing a wrapper function at the thread entry point (which does not
use parallel SSE), with all gcc functions compiled with normal options
(not -Os, which sets a smaller value in -mpreferred-stack-alignment).
To speculate further, possibly your pthreads library was compiled with
options which don't pass 16-byte aligned stack.
Thanks for the reply - no help though:
By a wrapper function, if you mean for f() to call say g() - this makes
no difference (command line: gcc -msse test.c -otest.exe).
gcc doesn't seem to recognize -mpreferred-stack-alignment=8 as a valid
option.
I'm not using pthreads, so it's not that either.
Sorry, you should have checked me. 'info gcc'
-mpreferred-stack-boundary=4 (2^4 == 16) is needed, and would be set
by options other than -O2. So, not specifying any relevant options
should be OK, but the function you call first in the thread must not
have any sse, if this is the problem.
I guess I don't understand where you got your function to start a thread.
I found -mpreferred-stack-boundary and -falign-functions options, I
think they both default to 4, so it's not relevant to set these (I'm not
using any optimizations).
I'll take a look at the assembly code and see if anything is different
(between gcc and msvc) for the thread function. It looks like gcc is
getting the stack four bytes off alignment in the thread function for
some reason.