[6723] in Athena Bugs

home help back first fref pref prev next nref lref last post

vax 7.1H: F77

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Fri Dec 28 09:40:41 1990

From: ellis@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Date: Fri, 28 Dec 90 09:40:29 EST

System name:		m33-222-9
Type and version:	PMAX 7.1H
Display type:		MONO

What were you trying to do?

    Compile and run the following code:
c
      character*20 a,b
c     
      print *, 'Enter integer'
      read *, N
      print *, 'Enter character string 1'
      read(5,'(a)') a
      print *, 'Enter character string 2'
      read *, b
      write(6,10) n,a,b
 10   format( "The integer entered:       ",i3,/
     $        "The first string entered:  ",a,/
     $        "The second string entered: ",a)
      stop 
      end


What's wrong:
      The code compiles without error, but the statement "read *, b" does
   not work correctly when "b" is a character variable. The input should be 
   list directed, i.e. a character string, since the variable b is declared 
   character, but after input, the string is filled with garbage.

Here is an example of this:

m33-222-9# a.out
 Enter integer
4
 Enter character string 1
abcdefg
 Enter character string 2
hijklmno
The integer entered:         4
The first string entered:  abcdefg
The second string entered: 0oB8


What should have happened:
     1. If the syntax of the READ is incorrect, an error message should
        be produced at compile time.

     2. If the syntax is acceptable, the string should not contain garbage.

Please describe any relevant documentation references:
     Fortran manual

home help back first fref pref prev next nref lref last post