-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Conversation
@llvm/pr-subscribers-flang-openmp @llvm/pr-subscribers-flang-semantics Author: Kiran Chandramohan (kiranchandramohan) ChangesDo not error out if default(none) is specified and the region has an assumed-size array. Fixes #110442 Full diff: https://github.com/llvm/llvm-project/pull/112963.diff 2 Files Affected:
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 186b58bcc52c35..81997c4df68b0c 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2047,6 +2047,7 @@ 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) && /*Assumed-size arrays are shared*/
!sym->owner().IsDerivedType() &&
sym->owner().kind() != Scope::Kind::ImpliedDos &&
!sym->detailsIf<semantics::AssocEntityDetails>() &&
diff --git a/flang/test/Semantics/OpenMP/default-none.f90 b/flang/test/Semantics/OpenMP/default-none.f90
index 11ba878ea77940..761c2385466a08 100644
--- a/flang/test/Semantics/OpenMP/default-none.f90
+++ b/flang/test/Semantics/OpenMP/default-none.f90
@@ -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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with Michael's suggestion
Do not error out if default(none) is specified and the region has an assumed-size array. Fixes llvm#110442
308241d
to
8a94ca9
Compare
Do not error out if default(none) is specified and the region has an assumed-size array. Fixes llvm#110442
Do not error out if default(none) is specified and the region has an assumed-size array.
Fixes #110442