On Thu, Dec 21, 2023 at 01:31:19PM +0100, Thomas Schwinge wrote: > These three: implicitly, or explicit '#pragma omp declare target' etc., > or inside '#pragma omp begin declare target' region are the only OpenMP > facilities to get things 'omp declare target'ed, right?
I think so. > That doesn't generally work, as the gimplification-level code re > 'Static locals [...] need to be "omp declare target"' runs *after* > 'omp_discover_implicit_declare_target'. Thus my "move" idea above. Can't we mark the static locals already during that discovery? The addition during gimplification was probably made when we didn't have that at all. > OK to push, for a start, the attached > "GCN, nvptx: Basic '__cxa_guard_{acquire,abort,release}' for C++ static local > variables support"? > That's now in libgcc not libgomp, so that it's also usable for GCN, nvptx > target testing, where we thus see a number of FAIL -> PASS progressions. > For now, for single-threaded GCN, nvptx target use only; extension for > multi-threaded offloading use to follow later. > > libgcc/ > * c++-minimal/README: New. > * c++-minimal/guard.c: New. > * config/gcn/t-amdgcn (LIB2ADD): Add it. > * config/nvptx/t-nvptx (LIB2ADD): Likewise. > +/* Copy'n'paste/edit from 'libstdc++-v3/libsupc++/cxxabi.h'. */ > + > + int > + __cxa_guard_acquire(__guard*); > + > + void > + __cxa_guard_release(__guard*); > + > + void > + __cxa_guard_abort(__guard*); When all this isn't inside a namespace, shouldn't it be indented by 2 spaces less? > + > +/* Copy'n'paste/edit from 'libstdc++-v3/libsupc++/guard.cc'. */ > + > +# undef _GLIBCXX_GUARD_TEST_AND_ACQUIRE > +# undef _GLIBCXX_GUARD_SET_AND_RELEASE > +# define _GLIBCXX_GUARD_SET_AND_RELEASE(G) _GLIBCXX_GUARD_SET (G) And without a space after # here? Otherwise LGTM, but hope that one day we'll get rid of it again. Jakub