[flang-commits] [flang] [flang][openacc] Only issue a warning when acc routine func is not found (PR #70964)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Wed Nov 1 10:35:14 PDT 2023


https://github.com/clementval created https://github.com/llvm/llvm-project/pull/70964

Do not issue a hard error when the function in acc routine directive is not present in the current translation unit. Only issue a warning. 

>From 6e429b047ed89d97a1371045c277277dabf688ce Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Wed, 1 Nov 2023 10:31:27 -0700
Subject: [PATCH] [flang][openacc] Only issue a warning when acc routine func
 is not found

---
 flang/lib/Lower/OpenACC.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 8218af691b79c86..348ab93e425b131 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -3295,9 +3295,12 @@ void Fortran::lower::finalizeOpenACCRoutineAttachment(
     mlir::func::FuncOp funcOp =
         mod.lookupSymbol<mlir::func::FuncOp>(mapping.first);
     if (!funcOp)
-      llvm::report_fatal_error(
-          "could not find function to attach OpenACC routine information.");
-    attachRoutineInfo(funcOp, mapping.second);
+      mlir::emitWarning(mod.getLoc(),
+                        llvm::Twine("function '") + llvm::Twine(mapping.first) +
+                            llvm::Twine("' in acc routine directive is not "
+                                        "found in this translation unit."));
+    else
+      attachRoutineInfo(funcOp, mapping.second);
   }
   accRoutineInfos.clear();
 }



More information about the flang-commits mailing list