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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libgomp/] [testsuite/] [libgomp.c++/] [pr30703.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
// PR c++/30703
2
// { dg-do run }
3
 
4
#include 
5
 
6
extern "C" void abort ();
7
 
8
int ctor, cctor, dtor;
9
 
10
struct A
11
{
12
  A();
13
  A(const A &);
14
  ~A();
15
  int i;
16
};
17
 
18
A::A()
19
{
20
#pragma omp atomic
21
  ctor++;
22
}
23
 
24
A::A(const A &r)
25
{
26
  i = r.i;
27
#pragma omp atomic
28
  cctor++;
29
}
30
 
31
A::~A()
32
{
33
#pragma omp atomic
34
  dtor++;
35
}
36
 
37
void
38
foo (A a, A b)
39
{
40
  int i, j = 0;
41
#pragma omp parallel for firstprivate (a) lastprivate (a) private (b) schedule (static, 1) num_threads (5)
42
  for (i = 0; i < 5; i++)
43
    {
44
      b.i = 5;
45
      if (a.i != 6)
46
        #pragma omp atomic
47
          j += 1;
48
      a.i = b.i + i + 6;
49
    }
50
 
51
  if (j || a.i != 15)
52
    abort ();
53
}
54
 
55
void
56
bar ()
57
{
58
  A a, b;
59
  a.i = 6;
60
  b.i = 7;
61
  foo (a, b);
62
}
63
 
64
int
65
main ()
66
{
67
  omp_set_dynamic (false);
68
  if (ctor || cctor || dtor)
69
    abort ();
70
  bar ();
71
  if (ctor + cctor != dtor)
72
    abort ();
73
}

powered by: WebSVN 2.1.0

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