[flang-commits] [flang] 5cbe39e - [flang][OpenMP] Allow default(none) to access variables with PARAMETER attribute

Nimish Mishra via flang-commits flang-commits at lists.llvm.org
Mon Jul 11 06:34:49 PDT 2022


Author: Nimish Mishra
Date: 2022-07-12T00:33:14+05:30
New Revision: 5cbe39ef880e0d8a61db111fca0b14b3ca17a17b

URL: https://github.com/llvm/llvm-project/commit/5cbe39ef880e0d8a61db111fca0b14b3ca17a17b
DIFF: https://github.com/llvm/llvm-project/commit/5cbe39ef880e0d8a61db111fca0b14b3ca17a17b.diff

LOG: [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

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-directives.cpp
    flang/test/Semantics/OpenMP/omp-resolve05.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index bb42638a308ee..0bb8798c62c7d 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -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).

diff  --git a/flang/test/Semantics/OpenMP/omp-resolve05.f90 b/flang/test/Semantics/OpenMP/omp-resolve05.f90
index 509e67becf295..00f4860302183 100644
--- 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 @@ 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
 


        


More information about the flang-commits mailing list