[flang][OpenMP] Allow default(none) to access variables with PARAMETER attribute

This patch fixes https://github.com/flang-compiler/f18-llvm-project/issues/1351.
Concretely, data-sharing attributes on PARAMETER data used in a block
with DEFAULT(NONE) should be ignored.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D129444
This commit is contained in:
Nimish Mishra 2022-07-11 21:23:41 +05:30
parent 1e10d35ea9
commit 5cbe39ef88
2 changed files with 3 additions and 3 deletions

View File

@ -1475,7 +1475,7 @@ void OmpAttributeVisitor::Post(const parser::Name &name) {
auto *symbol{name.symbol};
if (symbol && !dirContext_.empty() && GetContext().withinConstruct) {
if (!symbol->owner().IsDerivedType() && !symbol->has<ProcEntityDetails>() &&
!IsObjectWithDSA(*symbol)) {
!IsObjectWithDSA(*symbol) && !IsNamedConstant(*symbol)) {
// TODO: create a separate function to go through the rules for
// predetermined, explicitly determined, and implicitly
// determined data-sharing attributes (2.15.1.1).

View File

@ -5,7 +5,7 @@
subroutine default_none()
integer a(3)
integer, parameter :: D=10
A = 1
B = 2
!$omp parallel default(none) private(c)
@ -13,7 +13,7 @@ subroutine default_none()
A(1:2) = 3
!ERROR: The DEFAULT(NONE) clause requires that 'b' must be listed in a data-sharing attribute clause
B = 4
C = 5
C = 5 + D
!$omp end parallel
end subroutine default_none