OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c++/] [pr26943.C] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 273 jeremybenn
// PR c++/26943
2
// { dg-do run }
3
 
4
#include 
5
#include 
6
 
7
struct S
8
{
9
  public:
10
    int x;
11
    S () : x(-1) { }
12
    S (const S &);
13
    S& operator= (const S &);
14
    void test ();
15
};
16
 
17
static volatile int hold;
18
 
19
S::S (const S &s)
20
{
21
  #pragma omp master
22
    sleep (1);
23
 
24
  assert (s.x == -1);
25
  x = 0;
26
}
27
 
28
S&
29
S::operator= (const S& s)
30
{
31
  assert (s.x == 1);
32
  x = 2;
33
  return *this;
34
}
35
 
36
void
37
S::test ()
38
{
39
  assert (x == 0);
40
  x = 1;
41
}
42
 
43
static S x;
44
 
45
void
46
foo ()
47
{
48
  #pragma omp sections firstprivate(x) lastprivate(x)
49
  {
50
    x.test();
51
  }
52
}
53
 
54
int
55
main ()
56
{
57
  #pragma omp parallel num_threads(2)
58
    foo();
59
 
60
  assert (x.x == 2);
61
  return 0;
62
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.