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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libgomp/] [testsuite/] [libgomp.c/] [shared-2.c] - Blame information for rev 867

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

Line No. Rev Author Line
1 38 julius
#include <stdio.h>
2
#include <omp.h>
3
 
4
extern void abort (void);
5
 
6
void
7
parallel (int a, int b)
8
{
9
  int bad, LASTPRIV, LASTPRIV_SEC;
10
  int i;
11
 
12
  a = b = 3;
13
 
14
  bad = 0;
15
 
16
  #pragma omp parallel firstprivate (a,b) shared (bad) num_threads (5)
17
    {
18
      if (a != 3 || b != 3)
19
        bad = 1;
20
 
21
      #pragma omp for lastprivate (LASTPRIV)
22
      for (i = 0; i < 10; i++)
23
        LASTPRIV = i;
24
 
25
      #pragma omp sections lastprivate (LASTPRIV_SEC)
26
        {
27
          #pragma omp section
28
            { LASTPRIV_SEC = 3; }
29
 
30
          #pragma omp section
31
            { LASTPRIV_SEC = 42; }
32
        }
33
 
34
    }
35
 
36
  if (LASTPRIV != 9)
37
    abort ();
38
 
39
  if (LASTPRIV_SEC != 42)
40
    abort ();
41
 
42
  if (bad)
43
    abort ();
44
}
45
 
46
int main()
47
{
48
  parallel (1, 2);
49
  return 0;
50
}

powered by: WebSVN 2.1.0

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