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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 273 jeremybenn
// { dg-do run }
2
 
3
extern "C" void abort ();
4
 
5
struct A
6
{
7
  A ();
8
  ~A ();
9
  A (const A &);
10
  unsigned long l;
11
};
12
 
13
int e;
14
 
15
A::A ()
16
{
17
  l = 17;
18
}
19
 
20
A::~A ()
21
{
22
  if (l > 30)
23
    #pragma omp atomic
24
      e++;
25
}
26
 
27
A::A (const A &r)
28
{
29
  l = r.l;
30
}
31
 
32
void
33
check (int i, A &a, int j, A &b)
34
{
35
  if (i != 6 || a.l != 21 || j != 0 || b.l != 23)
36
    #pragma omp atomic
37
      e++;
38
}
39
 
40
A b;
41
int j;
42
 
43
void
44
foo (int i)
45
{
46
  A a;
47
  a.l = 21;
48
  #pragma omp task firstprivate (i, a, j, b)
49
    check (i, a, j, b);
50
}
51
 
52
void
53
bar (int i, A a)
54
{
55
  a.l = 21;
56
  #pragma omp task firstprivate (i, a, j, b)
57
    check (i, a, j, b);
58
}
59
 
60
A
61
baz ()
62
{
63
  A a, c;
64
  a.l = 21;
65
  c.l = 23;
66
  #pragma omp task firstprivate (a, c)
67
    check (6, a, 0, c);
68
  return a;
69
}
70
 
71
int
72
main ()
73
{
74
  b.l = 23;
75
  foo (6);
76
  bar (6, A ());
77
  baz ();
78
  #pragma omp parallel num_threads (4)
79
    {
80
      #pragma omp single
81
        for (int i = 0; i < 64; i++)
82
          {
83
            foo (6);
84
            bar (6, A ());
85
            baz ();
86
          }
87
    }
88
  if (e)
89
    abort ();
90
}

powered by: WebSVN 2.1.0

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