Skip to content

Assumed-size arrays are shared and cannot be privatized #112963

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
Oct 27, 2024
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
2 changes: 2 additions & 0 deletions flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,8 @@ void OmpAttributeVisitor::Post(const parser::OpenMPAllocatorsConstruct &x) {
static bool IsPrivatizable(const Symbol *sym) {
auto *misc{sym->detailsIf<MiscDetails>()};
return !IsProcedure(*sym) && !IsNamedConstant(*sym) &&
!semantics::IsAssumedSizeArray(
*sym) && /* OpenMP 5.2, 5.1.1: Assumed-size arrays are shared*/
!sym->owner().IsDerivedType() &&
sym->owner().kind() != Scope::Kind::ImpliedDos &&
!sym->detailsIf<semantics::AssocEntityDetails>() &&
Expand Down
11 changes: 11 additions & 0 deletions flang/test/Semantics/OpenMP/default-none.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,14 @@ subroutine sb4
end do loop
!$omp end parallel
end subroutine

! Test that default(none) does not error for assumed-size array
subroutine sub( aaa)
real,dimension(*),intent(in)::aaa
integer::ip
real::ccc
!$omp parallel do private(ip,ccc) default(none)
do ip = 1, 10
ccc= aaa(ip)
end do
end subroutine sub
Loading