Hi Tom! Thanks for looking into this one!
Just one quick comment: On Fri, 14 Dec 2018 10:21:35 +0100, Tom de Vries <tdevr...@suse.de> wrote: > --- a/gcc/lto-cgraph.c > +++ b/gcc/lto-cgraph.c > +#ifdef ACCEL_COMPILER > + if (in_other_partition) > + { > + if (TREE_CODE (decl) == FUNCTION_DECL > + || TREE_CODE (decl) == VAR_DECL) > + error_at (DECL_SOURCE_LOCATION (decl), > + "%s %qs has been referenced in offloaded code but" > + " hasn't been marked to be included in the offloaded code", > + TREE_CODE (decl) == FUNCTION_DECL ? "function" : "variable", > + name); > + else > + gcc_unreachable (); > + } > +#else > + gcc_assert (!in_other_partition > + && !used_from_other_partition); > +#endif Given the above... > --- /dev/null > +++ b/libgomp/testsuite/libgomp.c-c++-common/function-not-offloaded.c > @@ -0,0 +1,21 @@ > +/* { dg-do link } */ > +/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" } */ > + > +#pragma omp declare target > +int results[2000]; > +#pragma omp end declare target > + > +void __attribute__((noinline, noclone)) > +baz (int i) /* { dg-error "function 'baz' has been referenced in offloaded > code but hasn't been marked to be included in the offloaded code" } */ I think this error will trigger only if offloading compilation is enabled, so this error or the whole test case needs to be conditionalized on that? > --- /dev/null > +++ b/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c > @@ -0,0 +1,21 @@ > +/* { dg-do link } */ > +/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" } */ > + > +int results[2000]; /* { dg-error "variable 'results' has been referenced in > offloaded code but hasn't been marked to be included in the offloaded code" } > */ Likewise. Grüße Thomas