Passing a string inline to a subroutine call, where the parameter has defined length, gives unexpected results
问题 I found this code to behave unexpectedly module testmodule integer, parameter :: LCHARS = 50 contains subroutine init() call foobar("foobar") end subroutine subroutine foobar(s) character(len=*), intent(in) :: s call bar(s) end subroutine subroutine bar(str) character(len=LCHARS), intent(in) :: str print *, str end subroutine end module program foo use testmodule call init() end program This code prints garbage which is compiler dependent. I see the problem being the fact that I am jumping