[llvm] [flang-rt] Fixes EXECUTE_COMMAND_LINE() status management and double buffering (PR #184285)

Eugene Epshteyn via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 19:28:57 PST 2026


================
@@ -74,62 +76,81 @@ std::int64_t TerminationCheck(std::int64_t status, const Descriptor *cmdstat,
     // On Windows, ENOENT means the command interpreter can't be found.
     // On Linux, system calls execl with filepath "/bin/sh", ENOENT means the
     // file pathname does not exist.
+    constexpr char msg[] = "Command line execution is not supported, system "
+                           "returns -1 with errno ENOENT.";
     if (errno == ENOENT) {
       if (!cmdstat) {
-        terminator.Crash("Command line execution is not supported, system "
-                         "returns -1 with errno ENOENT.");
+        terminator.Crash(msg);
       } else {
         StoreIntToDescriptor(cmdstat, NO_SUPPORT_ERR, terminator);
-        CheckAndCopyCharsToDescriptor(cmdmsg,
-            "Command line execution is not supported, system returns -1 with "
-            "errno ENOENT.");
+        CheckAndCopyCharsToDescriptor(cmdmsg, msg);
+        return status;
       }
     } else {
-      char err_buffer[30];
-      char msg[]{"Execution error with system status code: -1, errno: "};
+      char msg[256]{"Execution error with system status code: -1, errno: "};
----------------
eugeneepshteyn wrote:

Changed this code to avoid `AllocateMemoryOrCrash()` allocation.

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


More information about the llvm-commits mailing list