On Tue, Apr 22, 2025 at 10:47:31AM -0400, Jason Merrill wrote: > On 4/21/25 6:46 AM, Nathaniel Shead wrote: > > I don't really know how OpenMP works, hopefully this makes sense. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? > > And for 15 (I guess after release)? > > This is OK with a FIXME; presumably if we want to support running static > constructors on the offload target we will eventually want to support that > in modules as well.
The previous fixes were just to make sure omp_target mangles slightly differently from !omp_target. Though those names were non-exported names, while supposedly the mangle_module_global_init returned names are global. In the end the omp_target ctors should be nohost and !omp_target ctors host, but using the same mangled name for both could cause problems if the host needs to refer to the target copy somewhere. > > --- /dev/null > > +++ b/gcc/testsuite/g++.dg/modules/openmp-1.C > > @@ -0,0 +1,9 @@ > > +// PR c++/119864 > > +// { dg-do assemble } > > +// { dg-additional-options "-fmodules -fopenmp" } > > +// { dg-require-effective-target "fopenmp" } > > + > > +export module M; > > + > > +int foo(); > > +int x = foo(); I don't see why there should be omp_target case here though. There is no #pragma omp declare target enter (x) or something similar. Jakub