1*404b540aSrobert /* { dg-do run } */
2*404b540aSrobert 
3*404b540aSrobert #include <stdio.h>
4*404b540aSrobert 
5*404b540aSrobert void
work(int n)6*404b540aSrobert work (int n)
7*404b540aSrobert {
8*404b540aSrobert   printf ("[%d of %d], nested = %d, n = %d\n", omp_get_thread_num (), omp_get_num_threads(), omp_get_nested (), n);
9*404b540aSrobert }
10*404b540aSrobert 
11*404b540aSrobert void
sub3(int n)12*404b540aSrobert sub3 (int n)
13*404b540aSrobert {
14*404b540aSrobert   work (n);
15*404b540aSrobert #pragma omp barrier
16*404b540aSrobert   work (n);
17*404b540aSrobert }
18*404b540aSrobert 
19*404b540aSrobert void
sub2(int k)20*404b540aSrobert sub2 (int k)
21*404b540aSrobert {
22*404b540aSrobert #pragma omp parallel shared(k)
23*404b540aSrobert   sub3 (k);
24*404b540aSrobert }
25*404b540aSrobert 
26*404b540aSrobert void
sub1(int n)27*404b540aSrobert sub1 (int n)
28*404b540aSrobert {
29*404b540aSrobert   int i;
30*404b540aSrobert #pragma omp parallel private(i) shared(n)
31*404b540aSrobert   {
32*404b540aSrobert #pragma omp for
33*404b540aSrobert     for (i = 0; i < n; i++)
34*404b540aSrobert       sub2 (i);
35*404b540aSrobert   }
36*404b540aSrobert }
37*404b540aSrobert int
main()38*404b540aSrobert main ()
39*404b540aSrobert {
40*404b540aSrobert   sub1 (2);
41*404b540aSrobert   sub2 (15);
42*404b540aSrobert   sub3 (20);
43*404b540aSrobert   return 0;
44*404b540aSrobert }
45