https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67141
Bug ID: 67141 Summary: wrong libgomp mutex initialisation order Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: mattiase at acm dot org CC: jakub at gcc dot gnu.org Target Milestone: --- Libgomp may use a mutex, acc_device_lock, prior to initialising it depending on the constructor calling order: it is initialised in initialize_env and used in goacc_host_init, both declared __attribute__ ((constructor)) but in different files. This was discovered on Windows after a change to the pthread library in mingw-w64, making all-zero an invalid mutex value. Apparently the constructors were called in the "wrong" order, and pthread_mutex_lock called before pthread_mutex_init.