(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.c-c++-common/
task-detach-3.c
       1  /* { dg-do run } */
       2  
       3  #include <omp.h>
       4  #include <assert.h>
       5  
       6  /* Test the task detach clause used together with dependencies.  */
       7  
       8  int main (void)
       9  {
      10    omp_event_handle_t detach_event;
      11    int x = 0, y = 0, z = 0;
      12    int dep;
      13  
      14    #pragma omp parallel
      15      #pragma omp single
      16      {
      17        #pragma omp task depend (out:dep) detach (detach_event)
      18  	x++;
      19  
      20        #pragma omp task
      21        {
      22  	y++;
      23  	omp_fulfill_event (detach_event);
      24        }
      25  
      26        #pragma omp task depend (in:dep)
      27  	z++;
      28      }
      29  
      30    assert (x == 1);
      31    assert (y == 1);
      32    assert (z == 1);
      33  }