https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117643
--- Comment #1 from kargls at comcast dot net --- Here's a testcase (obviously untested). ! ! { dg-do run } ! program foo use iso_c_binding, only : c_null_char, f_c_string logical, volatile :: asis character(len=6, kind=c_char) s1 character(len=:, kind=c_char), allocatable :: s2 s1 = 'abc ' s2 = f_c_string(s1) if (len(s2) /= len_trim(s1) + 1) stop 1 s2 = f_c_string(s1, .true.) if (len(s2) /= len(s1) + 1) stop 2 s2 = f_c_string(s1, .false.) if (len(s2) /= len_trim(s1) + 1) stop 3 asis = .true. s2 = f_c_string(s1, asis) if (len(s2) /= len(s1) + 1) stop 4 asis = .false. s2 = f_c_string(s1, asis) if (len(s2) /= len_trim(s1) + 1) stop 5 end program foo