aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/teams-1.c
blob: 977e5fc53234a6f573468591c63df2691f38e855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-additional-options "-Wno-deprecated-declarations" } */

#include <omp.h>
#include <stdlib.h>

int
main ()
{
  #pragma omp teams thread_limit (2)
  {
    if (omp_in_parallel ()
	|| omp_get_level () != 0
	|| omp_get_ancestor_thread_num (0) != 0
	|| omp_get_ancestor_thread_num (1) != -1)
      abort ();
    omp_set_dynamic (0);
    omp_set_nested (1);
    #pragma omp parallel num_threads (2)
    {
      if (!omp_in_parallel ()
	  || omp_get_level () != 1
	  || omp_get_ancestor_thread_num (0) != 0
	  || omp_get_ancestor_thread_num (1) != omp_get_thread_num ()
	  || omp_get_ancestor_thread_num (2) != -1)
	abort ();
    }
  }
  return 0;
}