1  /* { dg-additional-options "-Wno-deprecated-declarations" } */
       2  
       3  #include <omp.h>
       4  #include <stdlib.h>
       5  
       6  int
       7  main ()
       8  {
       9    omp_set_dynamic (0);
      10    omp_set_nested (1);
      11    #pragma omp teams thread_limit (2)
      12    {
      13      #pragma omp distribute dist_schedule(static,1)
      14      for (int i = 0; i < 1; ++i)
      15      if (omp_in_parallel ()
      16  	|| omp_get_level () != 0
      17  	|| omp_get_ancestor_thread_num (0) != 0
      18  	|| omp_get_ancestor_thread_num (1) != -1)
      19        abort ();
      20      #pragma omp parallel num_threads (2)
      21      {
      22        if (!omp_in_parallel ()
      23  	  || omp_get_level () != 1
      24  	  || omp_get_ancestor_thread_num (0) != 0
      25  	  || omp_get_ancestor_thread_num (1) != omp_get_thread_num ()
      26  	  || omp_get_ancestor_thread_num (2) != -1)
      27  	abort ();
      28      }
      29    }
      30    return 0;
      31  }