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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c/] [pr35130.c] - Blame information for rev 320

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

Line No. Rev Author Line
1 273 jeremybenn
/* PR middle-end/35130 */
2
 
3
extern void abort (void);
4
 
5
void
6
f1 (void)
7
{
8
  int a[4], k;
9
  void nested (int x)
10
  {
11
    a[x] = 42;
12
  }
13
 
14
  for (k = 0; k < 4; k++)
15
    a[k] = 0;
16
#pragma omp parallel for
17
  for (k = 0; k < 4; k++)
18
    nested (k);
19
 
20
  if (a[0] != 42 || a[1] != 42 || a[2] != 42 || a[3] != 42)
21
    abort ();
22
}
23
 
24
void
25
f2 (void)
26
{
27
  int a[4], k;
28
  void nested (void)
29
  {
30
    int l;
31
    void nested2 (int x)
32
    {
33
      a[x] = 42;
34
    }
35
#pragma omp parallel for
36
    for (l = 0; l < 4; l++)
37
      nested2 (l);
38
  }
39
 
40
  for (k = 0; k < 4; k++)
41
    a[k] = 0;
42
 
43
  nested ();
44
 
45
  if (a[0] != 42 || a[1] != 42 || a[2] != 42 || a[3] != 42)
46
    abort ();
47
}
48
 
49
void
50
f3 (void)
51
{
52
  int a[4], b[4], c[4], k;
53
  void nested (int x)
54
  {
55
    a[x] = b[x] = c[x] = 42;
56
  }
57
 
58
  for (k = 0; k < 4; k++)
59
    a[k] = b[k] = c[k] = 0;
60
  nested (0);
61
 
62
#pragma omp parallel
63
  {
64
  #pragma omp single
65
    {
66
      a[1] = 43;
67
      b[1] = 43;
68
    }
69
  #pragma omp parallel
70
    {
71
    #pragma omp single
72
      {
73
        b[2] = 44;
74
        c[2] = 44;
75
      }
76
    }
77
  }
78
 
79
  if (a[0] != 42 || a[1] != 43 || a[2] != 0 || a[3] != 0)
80
    abort ();
81
  if (b[0] != 42 || b[1] != 43 || b[2] != 44 || b[3] != 0)
82
    abort ();
83
  if (c[0] != 42 || c[1] != 0 || c[2] != 44 || c[3] != 0)
84
    abort ();
85
}
86
 
87
void
88
f4 (void)
89
{
90
  int a[4], b[4], c[4], k;
91
  void nested ()
92
  {
93
  #pragma omp parallel
94
    {
95
    #pragma omp single
96
      {
97
        a[1] = 43;
98
        b[1] = 43;
99
      }
100
    #pragma omp parallel
101
      {
102
      #pragma omp single
103
        {
104
          b[2] = 44;
105
          c[2] = 44;
106
        }
107
      }
108
    }
109
  }
110
 
111
  for (k = 0; k < 4; k++)
112
    a[k] = b[k] = c[k] = k == 0 ? 42 : 0;
113
  nested ();
114
 
115
  if (a[0] != 42 || a[1] != 43 || a[2] != 0 || a[3] != 0)
116
    abort ();
117
  if (b[0] != 42 || b[1] != 43 || b[2] != 44 || b[3] != 0)
118
    abort ();
119
  if (c[0] != 42 || c[1] != 0 || c[2] != 44 || c[3] != 0)
120
    abort ();
121
}
122
 
123
int
124
main (void)
125
{
126
  f1 ();
127
  f2 ();
128
  f3 ();
129
  f4 ();
130
  return 0;
131
}

powered by: WebSVN 2.1.0

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