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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [gomp/] [nestedfn-1.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* This testcase violates the OpenMP requirements, as nested functions
2
   access the original variables.
3
   We test it just to make sure we don't ICE on it.  */
4
/* { dg-do compile } */
5
/* { dg-options "-O2 -fopenmp" } */
6
 
7
extern void abort (void);
8
extern int omp_get_thread_num ();
9
extern void omp_set_dynamic (int);
10
 
11
int
12
main (void)
13
{
14
  int j = 0, k = 6, l = 7, m = 8;
15
  void foo (void)
16
  {
17
    int i = 5;
18
    int bar (void)
19
    {
20
      return i + 1 + (j > 100 ? 10000 : 0);
21
    }
22
#pragma omp sections private (i)
23
    {
24
#pragma omp section
25
      {
26
        i = 6;
27
        if (bar () != 6)
28
#pragma omp atomic
29
          ++j;
30
      }
31
#pragma omp section
32
      {
33
        if (bar () != 6)
34
#pragma omp atomic
35
          ++j;
36
      }
37
    }
38
    if (k != 6 || l != 7 || m != 8)
39
#pragma omp atomic
40
      ++j;
41
  }
42
  omp_set_dynamic (0);
43
#pragma omp parallel num_threads (2) firstprivate (k) shared (l) private (m)
44
  {
45
    if (omp_get_thread_num () != 0)
46
      k += omp_get_thread_num ();
47
    m = 9;
48
    foo ();
49
  }
50
  if (j)
51
    abort ();
52
  return 0;
53
}

powered by: WebSVN 2.1.0

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