Retro68/gcc/libgomp/testsuite/libgomp.c++/target-13.C

37 lines
486 B
C++
Raw Normal View History

2017-04-10 11:32:00 +00:00
extern "C" void abort (void);
int g;
#pragma omp declare target (g)
#pragma omp declare target
int
foo (void)
{
static int s;
return ++s + g;
}
#pragma omp end declare target
int
bar (void)
{
static int s;
#pragma omp declare target to (s)
return ++s;
}
#pragma omp declare target (bar)
int
main ()
{
int r;
#pragma omp target map(from:r)
{
r = (foo () == 1) + (bar () == 1);
r += (foo () == 2) + (bar () == 2);
}
if (r != 4)
abort ();
return 0;
}