You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flang] Fix const cast issue in FreeMemory function call in execute_command_line (#77906)
The FreeMemory function only accepts a void pointer, but it was being
called with a const char pointer, resulting in a type-casting issue.
To address this, the const was removed, use char * instead.
@@ -862,28 +862,50 @@ used in constant expressions have currently no folding support at all.
862
862
863
863
#### Implementation Specifics
864
864
865
-
-**`COMMAND`:**
866
-
- Must be preset.
865
+
##### `COMMAND`:
867
866
868
-
-**`WAIT`:**
869
-
- If set to `false`, the command is executed asynchronously. If not preset or set to `false`, it is executed synchronously.
870
-
- Sync: achieved by passing command into `std::system` on all systems.
871
-
- Async: achieved by calling a `fork()` on POSIX-compatible systems, or `CreateProcess()` on Windows.
867
+
- Must be preset.
872
868
873
-
-**`CMDSTAT`:**
869
+
##### `WAIT`:
870
+
871
+
- If set to `false`, the command is executed asynchronously.
872
+
- If not preset or set to `true`, it is executed synchronously.
873
+
- Synchronous execution is achieved by passing the command into `std::system` on all systems.
874
+
- Asynchronous execution is achieved by calling `fork()` on POSIX-compatible systems or `CreateProcess()` on Windows.
875
+
876
+
##### `EXITSTAT`:
877
+
878
+
- Synchronous execution:
879
+
- Inferred by the return value of `std::system(cmd)`.
880
+
- On POSIX-compatible systems: return value is first passed into `WEXITSTATUS(status)`, then assigned to `EXITSTAT`.
881
+
- On Windows, the value is directly assigned as the return value of `std::system()`.
882
+
- Asynchronous execution:
883
+
- Value is not modified.
884
+
885
+
##### `CMDSTAT`:
886
+
887
+
- Synchronous execution:
874
888
- -2: No error condition occurs, but `WAIT` is present with the value `false`, and the processor does not support asynchronous execution.
875
889
- -1: The processor does not support command line execution.
876
890
-\+ (positive value): An error condition occurs.
877
-
- 1: Fork Error, where `pid_t < 0`, would only occur on POSIX-compatible systems.
878
-
- 2: Execution Error, a command exits with status -1.
879
-
- 3: Invalid Command Error, determined by the exit code depending on the system.
880
-
- On Windows, if the exit code is 1.
881
-
- On POSIX-compatible systems, if the exit code is 127 or 126.
882
-
- 4: Signal error, either it is stopped or killed by signal, would only occur on POSIX-compatible systems.
891
+
- 1: Fork Error (occurs only on POSIX-compatible systems).
892
+
- 2: Execution Error (command exits with status -1).
893
+
- 3: Invalid Command Error (determined by the exit code depending on the system).
894
+
- On Windows: exit code is 1.
895
+
- On POSIX-compatible systems: exit code is 127 or 126.
896
+
- 4: Signal error (either stopped or killed by signal, occurs only on POSIX-compatible systems).
883
897
- 0: Otherwise.
898
+
- Asynchronous execution:
899
+
- 0 will always be assigned.
900
+
901
+
##### `CMDMSG`:
884
902
885
-
-**`CMDMSG`:**
886
-
- If an error condition occurs, it is assigned an explanatory message. Otherwise, it remains unchanged.
903
+
- Synchronous execution:
904
+
- If an error condition occurs, it is assigned an explanatory message; otherwise, it remains unchanged.
905
+
- If a condition occurs that would assign a nonzero value to `CMDSTAT` but the `CMDSTAT` variable is not present, error termination is initiated (applies to both POSIX-compatible systems and Windows).
906
+
- Asynchronous execution:
907
+
- The value is unchanged.
887
908
- If a condition occurs that would assign a nonzero value to `CMDSTAT` but the `CMDSTAT` variable is not present, error termination is initiated.
888
-
- On POSIX-compatible systems, this applies to both synchronous and asynchronous error termination. When the execution mode is set to async with error termination, the child process (async process) will be terminated with no effect on the parent process (continues).
889
-
- On Windows, this only applies to synchronous error termination.
909
+
- On POSIX-compatible systems, the child process (async process) will be terminated with no effect on the parent process (continues).
0 commit comments