On 17-12-18 13:46, Martin Jambor wrote: > Hi, > > On Fri, Dec 14 2018, Jakub Jelinek wrote: >> 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. >> > > so IIUC and IIRC, the testcase should have: > > { dg-require-effective-target offload_device_nonshared_as } >
Hi Martin, thanks for the confirmation. That's what's been used in the committed version. - Tom