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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> However, clang-20/clang++-20 compile the code.

For completeness, if both conditions - the 'collapse(2)' condition and the
'simd' condition - are true, Clang 20 also shows an error: "expected 2 for
loops after '#pragma omp target parallel for', but found only 1". Otherwise
(and this includes a dynamic selector), Clang will always accept the code -
even though it is invalid when a directive remains.

 * * *

GCC also rejects:

  #pragma omp target parallel for collapse(2) map(qq[:0]) private(i)
  for(k=0; k<blksize; k++)
    { 
      #pragma omp nothing
      for (i=0; i<nq; i++)

However, that's actually permitted in OpenMP 6.0:

"Additionally, intervening code must not contain _executable directives_ or
calls to the OpenMP runtime API in its corresponding region."

In OpenMP 5.1/5.2, there is:
"intervening-code — A non-empty structured block sequence that does not contain
OpenMP directives or calls to the OpenMP runtime API in its corresponding
region, referred to as intervening code"

However, that is ambiguous to what is permitted and the intent was clearly that
loop-transforming constructs (that yield canonical loop nests) are permitted to
follow a directives that takes a canonical loop nest.

It seems as if we need some:
              dir = c_omp_categorize_directive (directive[0], directive[1],
                                                directive[2]);
here and skip the error for C_OMP_DIR_DECLARATIVE / C_OMP_DIR_UTILITY (?) /
C_OMP_DIR_INFORMATIONAL / C_OMP_DIR_META (?)

where for utility, the problem is that it depends whether it is executable or
not:
  #pragma omp error message("executable directive") at(execution)
  #pragma omp error message("informational directive") at(compilation)

(albeit no 'tree' code remains after processing 'at(compilation)')

And for META it depends on the resulting tree - all informational (including
utility decayed to information) is fine [and declarative doesn't make sense
here].

Reply via email to