[flang-commits] [flang] [flang] add SYSTEM runtime and lowering intrinsics support (PR #74309)

Yi Wu via flang-commits flang-commits at lists.llvm.org
Thu Dec 7 07:49:31 PST 2023


================
@@ -282,4 +282,23 @@ std::int32_t RTNAME(GetEnvVariable)(const Descriptor &name,
   return StatOk;
 }
 
+void RTNAME(System)(const Descriptor *command, const Descriptor *exitstat,
+    const char *sourceFile, int line) {
+  Terminator terminator{sourceFile, line};
+
+  if (command) {
+    RUNTIME_CHECK(terminator, IsValidCharDescriptor(command));
+    int status{std::system(command->OffsetElement())};
----------------
yi-wu-arm wrote:

I've created a function to add `'\0'` in the end of command. It checks if the command is null-terminated or not, if not then create a new command with length+1 and null-terminated. This function can be re-used in `execute_command_line`. 

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


More information about the flang-commits mailing list