diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -1475,7 +1475,7 @@ auto *symbol{name.symbol}; if (symbol && !dirContext_.empty() && GetContext().withinConstruct) { if (!symbol->owner().IsDerivedType() && !symbol->has() && - !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). diff --git a/flang/test/Semantics/OpenMP/omp-resolve05.f90 b/flang/test/Semantics/OpenMP/omp-resolve05.f90 --- a/flang/test/Semantics/OpenMP/omp-resolve05.f90 +++ b/flang/test/Semantics/OpenMP/omp-resolve05.f90 @@ -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 @@ 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