This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Misalignment of local SSE variables in thread function
- From: Brian Dessent <brian at dessent dot net>
- To: Jonathan Kinsey <jon_kinsey at hotmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 18 Jan 2007 06:12:21 -0800
- Subject: Re: Misalignment of local SSE variables in thread function
- References: <BAY108-DAV4CDFCBB7A9C63D78CD854F8AB0@phx.gbl>
- Reply-to: gcc-help at gcc dot gnu dot org
Jonathan Kinsey wrote:
> This is a problem that I've seen in the archives and is marked as not
> being a problem with gcc. I'm not sure what the solution is though, the
> simple test below runs fine using the Microsoft compiler (on windows)
> and fails using gcc (3.4.5) compiler. There is no pthreads or glib code
> here.
>
> The output shows that the second call to f(), in the thread, has a
> misaligned s variable (which will crash in a SSE call).
You should be using _beginthreadex() instead, which ensures that the
stack is 16 byte aligned. <http://mingw.org/MinGWiki/index.php/threads>
Brian