Skip to content

Commit

Permalink
[flang][openacc] Disallow the zero modifier on the copyout clause wit…
Browse files Browse the repository at this point in the history
…h the declare directive

The OpenACC 3.3 specification does not allow the `zero` modifier
on the `copyout` clause used with the declare directive.

This is similar to D156703 for the create clause.

This might be missing piece in the spec but we disallow it until proven otherwise.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D156825
  • Loading branch information
clementval committed Aug 2, 2023
1 parent 5a1f87f commit b1f3667
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions flang/lib/Semantics/check-acc-structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ void AccStructureChecker::Enter(const parser::AccClause::Copyout &c) {
.str()),
ContextDirectiveAsFortran());
}
if (GetContext().directive == llvm::acc::Directive::ACCD_declare) {
context_.Say(GetContext().clauseSource,
"The ZERO modifier is not allowed for the %s clause "
"on the %s directive"_err_en_US,
parser::ToUpperCaseLetters(
llvm::acc::getOpenACCClauseName(llvm::acc::Clause::ACCC_copyout)
.str()),
ContextDirectiveAsFortran());
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions flang/test/Semantics/OpenACC/acc-declare-validity.f90
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ subroutine sub2(cc)
!$acc declare present(cc)
end subroutine sub2

subroutine sub3()
real :: aa(100)
!ERROR: The ZERO modifier is not allowed for the COPYOUT clause on the DECLARE directive
!$acc declare copyout(zero: aa)
end subroutine

end module openacc_declare_validity

0 comments on commit b1f3667

Please sign in to comment.