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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c++/] [ctor-12.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++/36308
2
// { dg-do run }
3
 
4
extern "C" void abort ();
5
 
6
static int n;
7
 
8
struct A
9
{
10
  A ()
11
  {
12
    l = 0;
13
    #pragma omp atomic
14
      ctors++;
15
  }
16
  A (const A &x)
17
  {
18
    l = x.l;
19
    #pragma omp atomic
20
      copyctors++;
21
  }
22
  virtual A& operator= (const A &x)
23
  {
24
    l = x.l;
25
    #pragma omp atomic
26
      assignops++;
27
    return *this;
28
  }
29
  virtual ~A ()
30
  {
31
    #pragma omp atomic
32
      dtors++;
33
  }
34
  int l;
35
  static int ctors, dtors, copyctors, assignops;
36
};
37
 
38
int A::ctors;
39
int A::dtors;
40
int A::copyctors;
41
int A::assignops;
42
 
43
int
44
main ()
45
{
46
  A a;
47
#pragma omp parallel private (a)
48
  {
49
    a.l = 6;
50
    #pragma omp single copyprivate (a)
51
    {
52
      a.l = 3;
53
    }
54
    if (a.l != 3)
55
      abort ();
56
    #pragma omp atomic
57
      n++;
58
  }
59
  if (A::ctors != n + 1
60
      || A::copyctors != 0
61
      || A::dtors != n
62
      || A::assignops != n - 1)
63
    abort ();
64
  return 0;
65
}

powered by: WebSVN 2.1.0

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