https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/176943
Backport 53d9d46d762207b2117eac9b0799bdd21b4b6dba Requested by: @kparzysz >From 83962e0f2167155465d736a0ea5061832964cecb Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Tue, 20 Jan 2026 08:04:04 -0600 Subject: [PATCH] [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) --- flang/lib/Semantics/check-omp-structure.cpp | 6 ------ flang/test/Semantics/OpenMP/use_device_addr1.f90 | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) 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
