[flang-commits] [flang] [llvm] [flang][MIF] Adding Stop and ErrorStop operations (PR #166787)

Jean-Didier PAILLEUX via flang-commits flang-commits at lists.llvm.org
Tue Jan 13 07:00:02 PST 2026


================
@@ -93,10 +100,34 @@ RT_API_ATTRS void Terminator::CrashHeader() const {
       sourceFileName_, sourceLine_);
 }
 
-// TODO: These will be defined in the coarray runtime library
-RT_API_ATTRS void NotifyOtherImagesOfNormalEnd() {}
-RT_API_ATTRS void NotifyOtherImagesOfFailImageStatement() {}
-RT_API_ATTRS void NotifyOtherImagesOfErrorTermination() {}
+void ExitHandler::Configure(bool mifEnabled) {
+  multiImageFeatureEnabled = mifEnabled;
+}
+
+void ExitHandler::Exit(int exitCode) {
+  if (multiImageFeatureEnabled)
+    if (exitCode == EXIT_SUCCESS)
+      SynchronizeImagesOfNormalEnd(exitCode);
+    else
+      NotifyOtherImagesOfErrorTermination(exitCode);
----------------
JDPailleux wrote:

Hi @bonachea , I've updated the code. I've modified `ExitHandler` with 2 different functions if whether we want a normal exit or an error exit.

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


More information about the flang-commits mailing list