1  extern void abort (void);
       2  int a[16], b[16], c[16], d[5][2];
       3  
       4  __attribute__((noinline, noclone)) void
       5  foo (int x, int y)
       6  {
       7    int i;
       8    #pragma omp for schedule (static, 1) reduction (+:a[:3])
       9    for (i = 0; i < 64; i++)
      10      {
      11        a[0] += i;
      12        a[1] += 2 * i;
      13        a[2] += 3 * i;
      14      }
      15    #pragma omp for schedule (guided) reduction (+:b[4:3])
      16    for (i = 0; i < 64; i++)
      17      {
      18        b[4] += i;
      19        b[5] += 2 * i;
      20        b[6] += 3 * i;
      21      }
      22    #pragma omp for schedule (static) reduction (+:c[x:4])
      23    for (i = 0; i < 64; i++)
      24      {
      25        c[9] += i;
      26        c[10] += 2 * i;
      27        c[11] += 3 * i;
      28        c[12] += 4 * i;
      29      }
      30    #pragma omp for reduction (+:d[x - 8:2][y:])
      31    for (i = 0; i < 64; i++)
      32      {
      33        d[1][0] += i;
      34        d[1][1] += 2 * i;
      35        d[2][0] += 3 * i;
      36        d[2][1] += 4 * i;
      37      }
      38  }
      39  
      40  int
      41  main ()
      42  {
      43    int i;
      44    #pragma omp parallel
      45    foo (9, 0);
      46    for (i = 0; i < 16; i++)
      47      if (a[i] != (i < 3 ? 64 * 63 / 2 * (i + 1) : 0)
      48  	|| b[i] != ((i >= 4 && i < 7) ? 64 * 63 / 2 * (i - 3) : 0)
      49  	|| c[i] != ((i >= 9 && i < 13) ? 64 * 63 / 2 * (i - 8) : 0))
      50        abort ();
      51    for (i = 0; i < 5; i++)
      52      if (d[i][0] != ((i && i <= 2) ? 64 * 63 / 2 * (2 * i - 1) : 0)
      53  	|| d[i][1] != ((i && i <= 2) ? 64 * 63 / 2 * (2 * i) : 0))
      54        abort ();
      55    return 0;
      56  }