[flang-commits] [flang] [Flang][OpenMP][Sema] Add OpenMP warning when mapping local descriptors to device on enter without a corresponding exit (PR #201060)
via flang-commits
flang-commits at lists.llvm.org
Wed Jun 10 00:13:39 PDT 2026
================
@@ -142,7 +141,35 @@ void OmpStructureChecker::Enter(const parser::SubroutineStmt &x) {
scopeStack_.push_back(sym->scope());
}
+void OmpStructureChecker::CheckTempDescriptorMappings() {
+ unsigned version{context_.langOptions().OpenMPVersion};
+ for (const auto &[symbol, source] : tempDescriptorEnterMaps_) {
+ if (tempDescriptorExitMaps_.find(symbol) == tempDescriptorExitMaps_.end()) {
+ if (version >= 61) {
+ context_.Warn(common::UsageWarning::OpenMPUsage, source,
+ "The map of '%s' may include a descriptor that is created locally. "
+ "Mapping this descriptor without an appropriate TARGET EXIT DATA "
+ "in the same scope may result in the device retaining an invalid "
+ "descriptor reference. To avoid mapping the descriptor utilize "
+ "OpenMP's ref_ptee reference modifier to map just the "
+ "data"_warn_en_US,
----------------
agozillon wrote:
That makes a lot of sense and is incredibly helpful!
https://github.com/llvm/llvm-project/pull/201060
More information about the flang-commits
mailing list