Skip to content

Commit 308241d

Browse files
Assumed-size arrays are shared and cannot be privatized
Do not error out if default(none) is specified and the region has an assumed-size array. Fixes #110442
1 parent e13f1d1 commit 308241d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,7 @@ void OmpAttributeVisitor::Post(const parser::OpenMPAllocatorsConstruct &x) {
20472047
static bool IsPrivatizable(const Symbol *sym) {
20482048
auto *misc{sym->detailsIf<MiscDetails>()};
20492049
return !IsProcedure(*sym) && !IsNamedConstant(*sym) &&
2050+
!semantics::IsAssumedSizeArray(*sym) && /*Assumed-size arrays are shared*/
20502051
!sym->owner().IsDerivedType() &&
20512052
sym->owner().kind() != Scope::Kind::ImpliedDos &&
20522053
!sym->detailsIf<semantics::AssocEntityDetails>() &&

flang/test/Semantics/OpenMP/default-none.f90

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,14 @@ subroutine sb4
4747
end do loop
4848
!$omp end parallel
4949
end subroutine
50+
51+
! Test that default(none) does not error for assumed-size array
52+
subroutine sub( aaa)
53+
real,dimension(*),intent(in)::aaa
54+
integer::ip
55+
real::ccc
56+
!$omp parallel do private(ip,ccc) default(none)
57+
do ip = 1, 10
58+
ccc= aaa(ip)
59+
end do
60+
end subroutine sub

0 commit comments

Comments
 (0)