[Bug fortran/32170] string badly passed as function arguments

mikael dot morin at tele2 dot fr gcc-bugzilla@gcc.gnu.org
Thu May 31 19:27:00 GMT 2007



------- Comment #4 from mikael dot morin at tele2 dot fr  2007-05-31 19:26 -------
$ export FILE=test6
$ cat $FILE.f                                


      program testchar

      character(len=30) :: str2


      write(str2,*) "string1"


      call test( str2 )
      call test("string2")



      end program 

      subroutine test(chars)

      character(len=30) :: chars

      write(6,*) chars

      end subroutine
$

Actually, I could have reported this case only, because it doesn't even use
string arrays. Both versions write junk on the terminal. 

$ FC=gfortran                                
$ $FC -v;$FC -o $FILE $FILE.f ; echo; ./$FILE
Lecture des spécification à partir de
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/specs
Target: x86_64-pc-linux-gnu
Configuré avec: /usr/src/gcc-4.1.2/configure --host=x86_64-pc-linux-gnu
--prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man
--enable-threads=posix --with-system-zlib --enable-languages=f95
--disable-multilib
Modèle de thread: posix
version gcc 4.1.2

  string1                      
 string2;0����L}
$


$ export FC=/usr/local/bin/gfortran          
$ $FC -v;$FC -o $FILE $FILE.f ; echo; ./$FILE
Utilisation des specs internes.
Target: x86_64-unknown-linux-gnu
Configuré avec: ../gcc-4.3-20070525/configure --enable-languages=fortran
--disable-multilib
Modèle de thread: posix
version gcc 4.3.0 20070525 (experimental)

  string1                      
 string2;4����Pb
$


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32170



More information about the Gcc-bugs mailing list