On Fri, Sep 18, 2015 at 03:41:30PM +0800, Chung-Lin Tang wrote: > this patch fixes the uninitialized acc_device_lock mutex situation > reported in PR 67141. The patch attached on the bugzilla page > tries to solve it by constructor priorities, which we think will > probably be less manageable in general. > > This patch changes goacc_host_init() to be called from > goacc_runtime_initialize() instead, thereby ensuring the init order. > libgomp testsuite was re-run without regressions, okay for trunk? > > Thanks, > Chung-Lin > > 2015-09-18 Chung-Lin Tang <clt...@codesourcery.com> > > PR libgomp/67141 >
No vertical space in between PR line and subsequent entries. > * oacc-int.h (goacc_host_init): Add declaration. > * oacc-host.c (goacc_host_init): Remove static and > constructor attribute Full stop at the end of entry. > * oacc-init.c (goacc_runtime_initialize): Call goacc_host_init() > at end. The patch is ok. Though, perhaps as a follow-up, I think I'd prefer getting rid of pthread_key_create (&goacc_cleanup_key, goacc_destroy_thread);, it is wasteful if we do the same thing in initialize_team. As the goacc_tls_data pointer is __thread anyway, I think just putting it into struct gomp_thread, arranging for init_team to be called from the env.c ctor and from the team TLS destructor call also some oacc freeing if the goacc_tls_data pointer is non-NULL (perhaps with __builtin_expect unlikely). Jakub