On Fri, Dec 14, 2018 at 10:21:35AM +0100, Tom de Vries wrote: > --- /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" } > */ > + > +#pragma omp declare target > +void __attribute__((noinline, noclone)) > +baz (int i) > +{ > + results[i]++; > +} > +#pragma omp end declare target > + > +int > +main () > +{ > +#pragma omp target > +#pragma omp for > + for (int i = 0; i < 2000; i++) > + baz (i); > +}
Ah, one more thing, the testcase doesn't really fail when offloading isn't configured, so it would need some effective target or something that it actually does the offloading. And not really sure about shared memory offloading like hsail, that doesn't really need the variables declared either, just the functions. Jakub