Author: Krzysztof Parzyszek
Date: 2026-01-21T08:04:01Z
New Revision: c71c065831874ca24333b95ba42f2788a0d1d1c9

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

LOG: [flang][OpenMP] Allow assumed-size arrays on USE_DEVICE_ADDR clause 
(#176815)

Assumed-size arrays do not present any issues here as they need to be
either already mapped into the device data environment, or otherwise
accessible on the target device.

(cherry picked from commit 53d9d46d762207b2117eac9b0799bdd21b4b6dba)

Added: 
    

Modified: 
    flang/lib/Semantics/check-omp-structure.cpp
    flang/test/Semantics/OpenMP/use_device_addr1.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-omp-structure.cpp 
b/flang/lib/Semantics/check-omp-structure.cpp
index 2acf0dee1f77e..7c7379d125f29 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -4848,7 +4848,6 @@ void OmpStructureChecker::Enter(const 
parser::OmpClause::UseDeviceAddr &x) {
   SymbolSourceMap currSymbols;
   GetSymbolsInObjectList(x.v, currSymbols);
   semantics::UnorderedSymbolSet listVars;
-  unsigned version{context_.langOptions().OpenMPVersion};
 
   for (auto [_, clause] :
       FindClauses(llvm::omp::Clause::OMPC_use_device_addr)) {
@@ -4862,11 +4861,6 @@ void OmpStructureChecker::Enter(const 
parser::OmpClause::UseDeviceAddr &x) {
           useDeviceAddrNameList.push_back(*name);
         }
       }
-      if (version < 60 && IsWholeAssumedSizeArray(ompObject)) {
-        auto maybeSource{GetObjectSource(ompObject)};
-        context_.Say(maybeSource.value_or(clause->source),
-            "Whole assumed-size arrays are not allowed on USE_DEVICE_ADDR 
clause"_err_en_US);
-      }
     }
     CheckMultipleOccurrence(
         listVars, useDeviceAddrNameList, clause->source, "USE_DEVICE_ADDR");

diff  --git a/flang/test/Semantics/OpenMP/use_device_addr1.f90 
b/flang/test/Semantics/OpenMP/use_device_addr1.f90
index 696ab3cc57278..1b5e4a26dc248 100644
--- a/flang/test/Semantics/OpenMP/use_device_addr1.f90
+++ b/flang/test/Semantics/OpenMP/use_device_addr1.f90
@@ -31,7 +31,7 @@ subroutine omp_target_data(asa)
       b = a
    !$omp end target data
 
-   !ERROR: Whole assumed-size arrays are not allowed on USE_DEVICE_ADDR clause
+   !No diagnostic expected, assumed-size arrays are ok
    !$omp target data use_device_addr(asa)
    !$omp end target data
 end subroutine omp_target_data


        
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to