[flang-commits] [flang] [flang] Implement CHDIR intrinsic (PR #124280)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Jan 28 02:37:43 PST 2025


================
@@ -1064,3 +1064,35 @@ This intrinsic is an alias for `LEN_TRIM`, without the optional KIND argument.
 - **Arguments:** `TIME` - a REAL value into which the elapsed CPU time in
                           seconds is written
 - **RETURN value:** same as TIME argument
+
+### Non-Standard Intrinsics: CHDIR
+
+#### Description
+`CHDIR(NAME[, STATUS])` Change current working directory to a specified path.
+
+This intrinsic is provided in both subroutine and function forms; however, only one form can be used in any given program unit.
+
+** and *STATUS* are `INTENT(OUT)` and provide the following:
+
+|            |                                                                                                   |
+|------------|---------------------------------------------------------------------------------------------------|
+| `NAME`     | The type shall be `CHARACTER` of default kind and shall specify a valid path within the file system.       |
+| `STATUS`   | (Optional) `INTEGER`status flag of the default kind. Returns 0 on success, and a system specific and nonzero error code otherwise. |
+
+#### Usage and Info
+
+- **Standard:** GNU extension
+- **Class:** Subroutine, function
+- **Syntax:** `CALL CHDIR(NAME[, STATUS])`, `STATUS = CHDIR(NAME)`
+
+#### Example
----------------
tblah wrote:

This example looks like it has come straight from the gfortran documentation.

gfortran code has an incompatible license to that used in LLVM. Please write your own example.

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


More information about the flang-commits mailing list