Skip to content

Commit 5cbe39e

Browse files
committed
[flang][OpenMP] Allow default(none) to access variables with PARAMETER attribute
This patch fixes flang-compiler#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
1 parent 1e10d35 commit 5cbe39e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ void OmpAttributeVisitor::Post(const parser::Name &name) {
14751475
auto *symbol{name.symbol};
14761476
if (symbol && !dirContext_.empty() && GetContext().withinConstruct) {
14771477
if (!symbol->owner().IsDerivedType() && !symbol->has<ProcEntityDetails>() &&
1478-
!IsObjectWithDSA(*symbol)) {
1478+
!IsObjectWithDSA(*symbol) && !IsNamedConstant(*symbol)) {
14791479
// TODO: create a separate function to go through the rules for
14801480
// predetermined, explicitly determined, and implicitly
14811481
// determined data-sharing attributes (2.15.1.1).

flang/test/Semantics/OpenMP/omp-resolve05.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
subroutine default_none()
77
integer a(3)
8-
8+
integer, parameter :: D=10
99
A = 1
1010
B = 2
1111
!$omp parallel default(none) private(c)
1212
!ERROR: The DEFAULT(NONE) clause requires that 'a' must be listed in a data-sharing attribute clause
1313
A(1:2) = 3
1414
!ERROR: The DEFAULT(NONE) clause requires that 'b' must be listed in a data-sharing attribute clause
1515
B = 4
16-
C = 5
16+
C = 5 + D
1717
!$omp end parallel
1818
end subroutine default_none
1919

0 commit comments

Comments
 (0)