Background : -OpenMP started from a pthread doesn't work for regular mingw. This has been reported in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42616 and is confirmed.
For that reason I switched to http://sourceforge.net/projects/mingw-w64/ which has the advantage of working TLS. My test case runs much better and further now. But it crashes 1 out of 5 times on my machine while cleaning up threads (gomp_free_thread). Some elementary analysis points very much in some weakness in the gomp_barrier for mingw. I'm tending to conclude that because : - adding some short Sleep() before the end of free_gomp_pool_helper makes it rocksolid. - It is rocksolid as well on Linux. I noticed that the barrier is implemented differentl there. -- Summary: OpenMP executes unreliably when used in pthread. Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: libgomp AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jos dot de_laender at telenet dot be GCC host triplet: i686-pc-mingw32 GCC target triplet: mingw64 - see description. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42828