This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4] Questions about "declare target" and "target update" pragmas


On Tue, Mar 10, 2015 at 19:52:52 +0300, Ilya Verbin wrote:
> Hi Jakub,
> 
> I have one more question :)
> This testcase seems to be correct... or not?
> 
> #pragma omp declare target
> extern int G;
> #pragma omp end declare target
> 
> int G;
> 
> int main ()
> {
>   #pragma omp target update to(G)
> 
>   return 0;
> }
> 
> If yes, then we have a problem that the decl of G in varpool_node::get_create
> doesn't have "omp declare target" attribute.

Ping?

I am investigating run-fails on some benchmark, and have found a second
questionable place, where a function argument overrides a global array.
Just to be sure, is this a bug in the test?

#pragma omp declare target
int a1[50], a2[50];
#pragma omp end declare target

void foo (int a1[])
{
  #pragma omp target
    {
      a1[10]++;
      a2[10]++;
    }
}

int main ()
{
  a1[10] = a2[10] = 10;

  #pragma omp target update to(a1, a2)
  foo (a1);
  #pragma omp target update from(a1, a2)

  if (a1[10] != a2[10])
    abort ();
  return 0;
}

Thanks,
  -- Ilya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]