[flang-commits] [flang] [Flang] [Semantics] [OpenMP] Add semantic checks for ALLOCATE directive (PR #123421)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Mon Jan 20 03:53:57 PST 2025


================
@@ -1504,6 +1504,28 @@ void OmpStructureChecker::Enter(const parser::OpenMPDeclarativeAllocate &x) {
   const auto &objectList{std::get<parser::OmpObjectList>(x.t)};
   PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_allocate);
   const auto &clauseList{std::get<parser::OmpClauseList>(x.t)};
+  SymbolSourceMap currSymbols;
+  GetSymbolsInObjectList(objectList, currSymbols);
+  for (auto &[symbol, source] : currSymbols) {
+    if (IsPointer(*symbol)) {
+      context_.Say(source,
+          "List item '%s' in ALLOCATE directive must not have POINTER "
+          "attribute"_err_en_US,
+          source.ToString());
+    }
+    if (IsDummy(*symbol)) {
+      context_.Say(source,
+          "List item '%s' in ALLOCATE directive must not be a dummy "
+          "argument"_err_en_US,
+          source.ToString());
+    }
+    if (symbol->has<AssocEntityDetails>()) {
----------------
kiranchandramohan wrote:

Check whether you need to use the Ultimate symbol here.

https://github.com/llvm/llvm-project/pull/123421


More information about the flang-commits mailing list