(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.c-c++-common/
pr66199-11.c
       1  /* PR middle-end/66199 */
       2  /* { dg-do run } */
       3  /* { dg-options "-O2" { target c } } */
       4  
       5  int u[1024], v[1024], w[1024];
       6  
       7  __attribute__((noinline, noclone)) long
       8  f2 (long a, long b, long c)
       9  {
      10    long d, e;
      11    #pragma omp teams distribute parallel for default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e)
      12    for (d = a; d < b; d++)
      13      {
      14        u[d] = v[d] + w[d];
      15        e = c + d * 5;
      16      }
      17    return d + e;
      18  }
      19  
      20  __attribute__((noinline, noclone)) long
      21  f3 (long a1, long b1, long a2, long b2)
      22  {
      23    long d1, d2;
      24    #pragma omp teams distribute parallel for default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
      25    for (d1 = a1; d1 < b1; d1++)
      26      for (d2 = a2; d2 < b2; d2++)
      27        u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
      28    return d1 + d2;
      29  }
      30  
      31  int
      32  main ()
      33  {
      34    if (f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
      35        || f3 (0, 32, 0, 32) != 64)
      36      __builtin_abort ();
      37    return 0;
      38  }