URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c++/] [task-3.C] - Rev 307
Go to most recent revision | Compare with Previous | Blame | View Log
// { dg-do run }
extern "C" void abort ();
struct A
{
A ();
~A ();
A (const A &);
unsigned long l;
};
int e;
A::A ()
{
l = 17;
}
A::~A ()
{
if (l > 30)
#pragma omp atomic
e++;
}
A::A (const A &r)
{
l = r.l;
}
void
check (int i, A &a, int j, A &b)
{
if (i != 6 || a.l != 21 || j != 0 || b.l != 23)
#pragma omp atomic
e++;
}
A b;
int j;
void
foo (int i)
{
A a;
a.l = 21;
#pragma omp task firstprivate (i, a, j, b)
check (i, a, j, b);
}
void
bar (int i, A a)
{
a.l = 21;
#pragma omp task firstprivate (i, a, j, b)
check (i, a, j, b);
}
A
baz ()
{
A a, c;
a.l = 21;
c.l = 23;
#pragma omp task firstprivate (a, c)
check (6, a, 0, c);
return a;
}
int
main ()
{
b.l = 23;
foo (6);
bar (6, A ());
baz ();
#pragma omp parallel num_threads (4)
{
#pragma omp single
for (int i = 0; i < 64; i++)
{
foo (6);
bar (6, A ());
baz ();
}
}
if (e)
abort ();
}
Go to most recent revision | Compare with Previous | Blame | View Log