Skip to content

Commit eef3766

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

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,8 @@ void OmpAttributeVisitor::Post(const parser::OpenMPAllocatorsConstruct &x) {
20522052
static bool IsPrivatizable(const Symbol *sym) {
20532053
auto *misc{sym->detailsIf<MiscDetails>()};
20542054
return !IsProcedure(*sym) && !IsNamedConstant(*sym) &&
2055+
!semantics::IsAssumedSizeArray(
2056+
*sym) && /* OpenMP 5.2, 5.1.1: Assumed-size arrays are shared*/
20552057
!sym->owner().IsDerivedType() &&
20562058
sym->owner().kind() != Scope::Kind::ImpliedDos &&
20572059
!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)