(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
gomp/
pr32468-1.c
       1  /* PR libgomp/32468 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -fopenmp -fdump-tree-ompexp" } */
       4  
       5  extern int printf (const char *, ...);
       6  extern int omp_get_thread_num (void), omp_get_num_threads (void);
       7  extern int bar (void);
       8  extern int baz (const char *, ...);
       9  
      10  void
      11  f1 (void)
      12  {
      13  #pragma omp parallel
      14    {
      15      baz ("%d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      16      #pragma omp sections
      17        {
      18  	#pragma omp section
      19  	printf ("section1 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      20  	#pragma omp section
      21  	printf ("section2 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      22        }
      23    }
      24  }
      25  
      26  void
      27  f2 (void)
      28  {
      29  #pragma omp parallel
      30    {
      31      #pragma omp sections
      32        {
      33  	#pragma omp section
      34  	printf ("section1 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      35  	#pragma omp section
      36  	printf ("section2 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      37        }
      38      baz ("%d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      39    }
      40  }
      41  
      42  void
      43  f3 (void)
      44  {
      45  #pragma omp parallel
      46    {
      47      int bb = bar ();
      48      #pragma omp sections
      49        {
      50  	#pragma omp section
      51  	printf ("section1 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      52  	#pragma omp section
      53  	printf ("section2 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      54        }
      55    }
      56  }
      57  
      58  void
      59  f4 (void)
      60  {
      61    int i;
      62  #pragma omp parallel
      63    {
      64      baz ("%d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      65      #pragma omp for schedule (dynamic, 15)
      66      for (i = 0; i < 10000; i++)
      67        printf ("section1 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      68    }
      69  }
      70  
      71  void
      72  f5 (void)
      73  {
      74    int i;
      75  #pragma omp parallel
      76    {
      77      #pragma omp for schedule (dynamic, 15)
      78      for (i = 0; i < 10000; i++)
      79        printf ("section1 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      80      baz ("%d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      81    }
      82  }
      83  
      84  void
      85  f6 (void)
      86  {
      87    int i;
      88  #pragma omp parallel
      89    {
      90      int bb = bar ();
      91      #pragma omp for schedule (runtime)
      92      for (i = 0; i < 10000; i++)
      93        printf ("section1 %d/%d\n", omp_get_thread_num (), omp_get_num_threads ());
      94    }
      95  }
      96  
      97  /* There should not be a GOMP_parallel_{loop,sections}* call.  */
      98  /* { dg-final { scan-tree-dump-times "GOMP_parallel_loop" 0 "ompexp"} } */
      99  /* { dg-final { scan-tree-dump-times "GOMP_parallel_sections" 0 "ompexp"} } */