1  extern void abort (void);
       2  
       3  int
       4  main ()
       5  {
       6    int a = 1, b = 2, c = 4, d[7];
       7    #pragma omp taskgroup
       8    {
       9      #pragma omp target enter data nowait map (to: a, b, c) depend(out: d[0])
      10      #pragma omp target nowait map (alloc: a, b) depend(in: d[0]) depend(out: d[1])
      11      {
      12        #pragma omp atomic update
      13        a |= 4;
      14        #pragma omp atomic update
      15        b |= 8;
      16      }
      17      #pragma omp target nowait map (alloc: a, c) depend(in: d[0]) depend(out: d[2])
      18      {
      19        #pragma omp atomic update
      20        a |= 16;
      21        #pragma omp atomic update
      22        c |= 32;
      23      }
      24      #pragma omp target exit data nowait map (from: a, b, c) depend(in: d[1], d[2])
      25    }
      26    if (a != 21 || b != 10 || c != 36)
      27      abort ();
      28    #pragma omp target map (tofrom: a, b) nowait
      29    {
      30      a &= ~16;
      31      b &= ~2;
      32    }
      33    #pragma omp target map (tofrom: c) nowait
      34    {
      35      c |= 8;
      36    }
      37    #pragma omp barrier
      38    if (a != 5 || b != 8 || c != 44)
      39      abort ();
      40    #pragma omp target map (tofrom: a, b) nowait
      41    {
      42      a |= 32;
      43      b |= 4;
      44    }
      45    #pragma omp target map (tofrom: c) nowait
      46    {
      47      c &= ~4;
      48    }
      49    #pragma omp taskwait
      50    if (a != 37 || b != 12 || c != 40)
      51      abort ();
      52    #pragma omp target nowait map (tofrom: a, b) depend(out: d[3])
      53    {
      54      #pragma omp atomic update
      55      a = a + 9;
      56      b -= 8;
      57    }
      58    #pragma omp target nowait map (tofrom: a, c) depend(out: d[4])
      59    {
      60      #pragma omp atomic update
      61      a = a + 4;
      62      c >>= 1;
      63    }
      64    #pragma omp task if (0) depend (in: d[3], d[4]) shared (a, b, c)
      65    if (a != 50 || b != 4 || c != 20)
      66      abort ();
      67    #pragma omp task shared (a)
      68    a += 50;
      69    #pragma omp target nowait map (tofrom: b)
      70    b++;
      71    #pragma omp target map (tofrom: c) nowait
      72    c--;
      73    #pragma omp taskwait
      74    if (a != 100 || b != 5 || c != 19)
      75      abort ();
      76    #pragma omp target map (tofrom: a) nowait depend(out: d[5])
      77    a++;
      78    #pragma omp target map (tofrom: b) nowait depend(out: d[6])
      79    b++;
      80    #pragma omp target map (tofrom: a, b) depend(in: d[5], d[6])
      81    {
      82      if (a != 101 || b != 6)
      83        a = -9;
      84      else
      85        {
      86  	a = 24;
      87  	b = 38;
      88        }
      89    }
      90    if (a != 24 || b != 38)
      91      abort ();
      92    return 0;
      93  }