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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c/] [pr26943-2.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++/26943 */
2
/* { dg-do run } */
3
 
4
extern int omp_set_dynamic (int);
5
extern void abort (void);
6
 
7
int a = 8, b = 12, c = 16, d = 20, j = 0;
8
char e[10] = "a", f[10] = "b", g[10] = "c", h[10] = "d";
9
 
10
int
11
main (void)
12
{
13
  int i;
14
  omp_set_dynamic (0);
15
#pragma omp parallel for shared (a, e) firstprivate (b, f) \
16
                         lastprivate (c, g) private (d, h) \
17
                         schedule (static, 1) num_threads (4) \
18
                         reduction (+:j)
19
  for (i = 0; i < 4; i++)
20
    {
21
      if (a != 8 || b != 12 || e[0] != 'a' || f[0] != 'b')
22
        j++;
23
#pragma omp barrier     /* { dg-warning "may not be closely nested" } */
24
#pragma omp atomic
25
      a += i;
26
      b += i;
27
      c = i;
28
      d = i;
29
#pragma omp atomic
30
      e[0] += i;
31
      f[0] += i;
32
      g[0] = 'g' + i;
33
      h[0] = 'h' + i;
34
#pragma omp barrier     /* { dg-warning "may not be closely nested" } */
35
      if (a != 8 + 6 || b != 12 + i || c != i || d != i)
36
        j += 8;
37
      if (e[0] != 'a' + 6 || f[0] != 'b' + i || g[0] != 'g' + i)
38
        j += 64;
39
      if (h[0] != 'h' + i)
40
        j += 512;
41
    }
42
  if (j || a != 8 + 6 || b != 12 || c != 3 || d != 20)
43
    abort ();
44
  if (e[0] != 'a' + 6 || f[0] != 'b' || g[0] != 'g' + 3 || h[0] != 'd')
45
    abort ();
46
  return 0;
47
}

powered by: WebSVN 2.1.0

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