URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 273 |
Rev 338 |
// PR c++/26943
|
// PR c++/26943
|
// { dg-do run }
|
// { dg-do run }
|
|
|
#include
|
#include
|
#include
|
#include
|
|
|
struct S
|
struct S
|
{
|
{
|
public:
|
public:
|
int x;
|
int x;
|
S () : x(-1) { }
|
S () : x(-1) { }
|
S (const S &);
|
S (const S &);
|
S& operator= (const S &);
|
S& operator= (const S &);
|
void test ();
|
void test ();
|
};
|
};
|
|
|
static volatile int hold;
|
static volatile int hold;
|
|
|
S::S (const S &s)
|
S::S (const S &s)
|
{
|
{
|
#pragma omp master
|
#pragma omp master
|
sleep (1);
|
sleep (1);
|
|
|
assert (s.x == -1);
|
assert (s.x == -1);
|
x = 0;
|
x = 0;
|
}
|
}
|
|
|
S&
|
S&
|
S::operator= (const S& s)
|
S::operator= (const S& s)
|
{
|
{
|
assert (s.x == 1);
|
assert (s.x == 1);
|
x = 2;
|
x = 2;
|
return *this;
|
return *this;
|
}
|
}
|
|
|
void
|
void
|
S::test ()
|
S::test ()
|
{
|
{
|
assert (x == 0);
|
assert (x == 0);
|
x = 1;
|
x = 1;
|
}
|
}
|
|
|
static S x;
|
static S x;
|
|
|
void
|
void
|
foo ()
|
foo ()
|
{
|
{
|
#pragma omp sections firstprivate(x) lastprivate(x)
|
#pragma omp sections firstprivate(x) lastprivate(x)
|
{
|
{
|
x.test();
|
x.test();
|
}
|
}
|
}
|
}
|
|
|
int
|
int
|
main ()
|
main ()
|
{
|
{
|
#pragma omp parallel num_threads(2)
|
#pragma omp parallel num_threads(2)
|
foo();
|
foo();
|
|
|
assert (x.x == 2);
|
assert (x.x == 2);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.