-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Am 06.08.2015 um 23:27 schrieb Mattias Engdegård: > 6 aug 2015 kl. 12.46 skrev Rainer Emrich <sf.rai...@emrich-ebersheim.de>: >> I assume that's caused by the latest winpthread changes. > > Sort of; it looks like a bug in libgomp that was tolerated by the old mutex > implementation. > > The acc_device_lock mutex is initialized in initialize_env and used in > goacc_host_init, both which are declared __attribute__ ((constructor)). > Such constructors are not called in a very predictable order, and > apparently we weren't lucky this time. > > The easy way is to make winpthread's mutex implementation more forgiving > (treating 0-filled memory as if it were PTHREAD_MUTEX_INITIALIZER). Patch: > > diff --git a/mingw-w64-libraries/winpthreads/src/mutex.c > b/mingw-w64-libraries/wi index fec341a..6e1b392 100644 --- > a/mingw-w64-libraries/winpthreads/src/mutex.c +++ > b/mingw-w64-libraries/winpthreads/src/mutex.c @@ -56,7 +56,10 @@ typedef > struct { static bool is_static_initializer(pthread_mutex_t m) { - return > (uintptr_t)m >= (uintptr_t)-3; + /* Treat 0 as a static initializer as > well (for normal mutexes), + to tolerate sloppy code in libgomp. (We > should rather fix that code!) */ + intptr_t v = (intptr_t)m; + return v > >= -3 && v <= 0; } > > /* Create and return the implementation part of a mutex from a static > This fixes the issue, libgom.sum attached. Can we have this in head and in 4.x ?
> Fixing libgomp is probably cleaner: either make sure the constructors are > run in the right order or initialize the acc_device_lock mutex statically. Are you willing to work on this? I can't, I don't have the skills. Thanks Rainer -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJVxKl4AAoJEB3HOsWs+KJbrBsIAKDsVw+xfMRanrCobwbdQMMx GrTsrpuGbOTPBxhNsXI7YmnHS65rKJW9QCgfRBmY6udz2s8KUf2el/2yyADbjtT4 c+AdELVGnQypI2iaf70w2/WEXGQaR76AJ8gAyHp181UAJIIHwCZj4uI0M1gxe2Gy /AsX84c2D7qduisc+SjGGkDgaK1+/zxopi7YWdU4Bp50/H+SK7HsgiJD84tKRQtV 9V96psZupm/R/m9UJS5AaRbObH8yHRxHF9/MVc0gMRjMaYiNSzTA3yujNWBTV2tP iCKmTASe3Em6lfx6gFM7qVa0pLnEIr37AQjnBw1l2yKkHjYUEJOh6NwnG/XqOks= =WYRN -----END PGP SIGNATURE----- ------------------------------------------------------------------------------ _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public