On Thu, Mar 12, 2015 at 04:56:35PM +0300, Ilya Verbin wrote: > This happens because the var_x is added into offload tables for both share.o > and > test.o. The patch below fixes this issue. Regtested on x86_64-linux and > i686-linux. However I'm not sure how to create a regression test, which would > compile 2 separate objects, and check run-time result.
Ok with proper ChangeLog entry. As for testcase, won't dg-additional-sources help? I mean, does it fail without your patch even if you just do gfortran -fopenmp -o a.out share.f90 test.f90; ./a.out ? > --- a/gcc/varpool.c > +++ b/gcc/varpool.c > @@ -173,7 +173,7 @@ varpool_node::get_create (tree decl) > node = varpool_node::create_empty (); > node->decl = decl; > > - if ((flag_openacc || flag_openmp) > + if ((flag_openacc || flag_openmp) && !DECL_EXTERNAL (decl) > && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl))) > { > node->offloadable = 1; Jakub