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

Jean-Didier PAILLEUX via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 14 06:56:04 PST 2026


================
@@ -93,10 +100,38 @@ 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::NormalExit(int exitCode) {
+  if (multiImageFeatureEnabled)
+    NotifyOtherImagesOfErrorTermination(exitCode);
+  else
+    std::exit(exitCode);
+}
+
+void ExitHandler::ErrorExit(int exitCode) {
+  if (multiImageFeatureEnabled)
+    SynchronizeImagesOfNormalEnd(exitCode);
+  else
+    std::exit(exitCode);
+}
----------------
JDPailleux wrote:

Yes, I definitely meant the opposite!
I also agree with this suggestion from [[noreturn]].

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


More information about the llvm-commits mailing list