[Bug fortran/37746] string copy fails, due to changed intent(in) parameter
--- Comment #3 from kloedej at knmi dot nl 2008-10-07 11:23 --- Hi, thanks for this discussion. I do agree now that this code was invalid. I was thinking otherwise because no compiletime or runtime error was issued by any of the compilers that I tried. Checking this during compilation should at least be possible when the interface of the subroutine is known, so when it is defined inside a module, but gfortran also accepts that case without complaining. best regards, Jos de Kloe. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37746
[Bug fortran/37746] string copy fails, due to changed intent(in) parameter
--- Comment #2 from burnus at gcc dot gnu dot org 2008-10-06 19:53 --- I think the true bug is that -fbounds-check misses the problem. NAG f95 prints at run time: CHARACTER actual arg LEN=50 shorter than dummy arg LEN=51 Program terminated by fatal error -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37746
[Bug fortran/37746] string copy fails, due to changed intent(in) parameter
--- Comment #1 from kargl at gcc dot gnu dot org 2008-10-06 14:47 --- Your code works if you fix the bug. You have two choices program Test_StrCopy character(len=50) :: a character(len=51) :: b a = "abcdefg" call copy(a,b) end program Test_StrCopy or subroutine copy(a,b) character(len=*), intent(in) :: a character(len=len(a)), intent(out) :: b -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37746