https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94137
Bug ID: 94137 Summary: [OpenACC] declare directive – currently *only* permitted after variable declaration Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: openacc, rejects-valid Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- The spec has: "A declare directive is used in the declaration section of a Fortran subroutine, function, or module, or following a variable declaration in C or C++." Hence, the an arbitrary order is permitted in Fortran (but not in C/C++). However, gfortran rejects the following as "A" is not known: !$acc declare copy(A) integer :: A dimension :: A(20) end gfortran currently requires that the identifier (gfc_symbol) is known when parsing the directive. Additionally, some checks are already performed on the symbol during parsing. I think those are fine and the critical checks are only performed during resolution, but I might be wrong.