[flang-commits] [flang] 53d9d46 - [flang][OpenMP] Allow assumed-size arrays on USE_DEVICE_ADDR clause (#176815)
via flang-commits
flang-commits at lists.llvm.org
Tue Jan 20 06:04:09 PST 2026
Author: Krzysztof Parzyszek
Date: 2026-01-20T08:04:04-06:00
New Revision: 53d9d46d762207b2117eac9b0799bdd21b4b6dba
URL: https://github.com/llvm/llvm-project/commit/53d9d46d762207b2117eac9b0799bdd21b4b6dba
DIFF: https://github.com/llvm/llvm-project/commit/53d9d46d762207b2117eac9b0799bdd21b4b6dba.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.
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 8383e3995af4f..cc8d968f7db83 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -4851,7 +4851,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)) {
@@ -4865,11 +4864,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
More information about the flang-commits
mailing list