Skip to content

[flang][openacc] Allow constant variable in data clause #71580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,8 @@ void AccAttributeVisitor::AllowOnlyVariable(const parser::AccObject &object) {
common::visitors{
[&](const parser::Designator &designator) {
const auto &name{GetLastName(designator)};
if (name.symbol && !semantics::IsVariableName(*name.symbol)) {
if (name.symbol && !semantics::IsVariableName(*name.symbol) &&
!semantics::IsNamedConstant(*name.symbol)) {
context_.Say(designator.source,
"Only variables are allowed in data clauses on the %s "
"directive"_err_en_US,
Expand Down
6 changes: 6 additions & 0 deletions flang/test/Semantics/OpenACC/acc-data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,10 @@ subroutine sub4(t)
!$acc data copy(t%t1_proc)
!$acc end data
end subroutine

subroutine sub5()
integer, parameter :: iparam = 1024
!$acc data copyin(iparam)
!$acc end data
end subroutine
end module