[Bug fortran/93826] [OpenMP][OpenACC] Collapsed loop – code silently ignored

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 20 13:45:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93826

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The C code rejects this as follows.

The OpenACC specification talks about "tightly nested loops"; the OpenMP spec
is less clear but for "collapse" contrary to "tile" the implication that
tightly nested loops are meant is not far.

----------------------
int foo (int x, int y) {
  int i, j;
#pragma omp parallel for collapse(2)
#pragma acc parallel loop collapse(2)
  for (i = 0; i < 2; ++i)
    {
      for (j = 0; j < 2; ++j)
        x = 5;
      y = 7;  /* { dg-error "collapsed loops not perfectly nested before 'y'" }
 */
    }
  return x + y;
}

int bar (int a, int b) {
  int i, j;
#pragma acc parallel loop tile(2,2)
  for (i = 0; i < 2; ++i)
    {
      for (j = 0; j < 2; ++j)
        a = 5;
      b = 7;  /* { dg-error "collapsed loops not perfectly nested before 'b'" }
 */
    }
  return a + b;
}


More information about the Gcc-bugs mailing list