[flang-commits] [flang] [llvm] [flang] Implement 'F_C_STRING' library function (Fortran 2023) (PR #174474)

Caroline Newcombe via flang-commits flang-commits at lists.llvm.org
Wed Jan 7 12:22:58 PST 2026


================
@@ -145,4 +145,18 @@ subroutine c_f_procpointer(cptr, fptr)
     ! TODO: implement
   end subroutine c_f_procpointer
 
+  ! F_C_STRING - Convert Fortran string to C null-terminated string
+  ! Fortran 2023 standard intrinsic
+  pure function f_c_string(string, asis) result(res)
+    character(kind=c_char, len=*), intent(in) :: string
+    logical, optional, intent(in) :: asis
+    character(kind=c_char, len=:), allocatable :: res
+
+    if (present(asis) .and. asis) then
----------------
cenewcombe wrote:

I moved the implementation to a submodule and fixed this oversight, thank you!

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


More information about the flang-commits mailing list