This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Misalignment of local SSE variables in thread function


Jonathan Kinsey wrote:

> Thanks for the link, unfortunately it doesn't work _beginthread just
> calls _beginthreadex - unless there is a alignment argument I didn't see
> (I tried it anyway and no luck).
> 
> If you read the end of the post at the link it says that it doesn't fix
> a SSE problem that someone was having - at least I'm not on my own...

I did read that but I hoped it was someone having unrelated problems.  I
guess it's not.

So, neither CreateThread nor MSVCRT align the stack, so I guess you'll
have to do it yourself.  You should be able to do this with something
like:

  asm  __volatile__  ("andl $-16, %%esp" : : : "%esp");

at the beginning of your thread function.  You could probably do this in
a wrapper-function that calls your actual thread function too.

You might also want to ask this on the MinGW list, as they'd know if
there was a better solution.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]