This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/17285] New: namelist write does not terminate with &end


An important use of namelist is to safeguard data using a concise statement, so 
that it can be read back later.  Thus it is essential that a namelist WRITE 
produces output that can be correctly readback by a namelist READ.  This is not 
the case for gfortran, at present.  It fails to write the requisite &end

$ cat bug2.f90;/irun/bin/gfortran -v bug2.f90 ; ./a.exe
program bug2
  integer, dimension(10) :: number =42
  namelist /mynml/ number
  open(unit=10,file='bug2.txt',status='unknown')
!
! write in acceptable format
!
  write(10,'(A)') "&mynml,number=42,&end"
!
! write the namelist itself
!
  write(10,mynml)
!!!  write(10,'(A)') "&end"   !!!! runs with this addition
!
! write again in acceptable format
!
  write(10,'(A)') "&mynml,number=42,&end"
  close(10)
!
! now read all 3 back
!
  open(unit=10,file='bug2.txt',status='old')
  read(10,mynml)
  print *, "1st READ is OK"
  write(*,mynml)
  read(10,mynml)
  print *, "2nd READ is OK"
  write(*,mynml)
  read(10,mynml)
  print *, "3rd READ is OK"
  write(*,mynml)
  close(10)
end program bug2
Driving: /irun/bin/gfortran -v bug2.f90 -lgfortranbegin -lgfortran
Reading specs from /irun/lib/gcc/i686-pc-cygwin/3.5.0/specs
Configured with: ../gcc-3.5-20040815/configure --with-gmp=/gmp --with-mpfr=/gmp
--prefix=/irun --enable-languages=c,c++,f95
Thread model: single
gcc version 3.5.0 20040815 (experimental)
 /irun/libexec/gcc/i686-pc-cygwin/3.5.0/f951.exe bug2.f90 -quiet -dumpbase bug2.
f90 -mtune=pentiumpro -auxbase bug2 -version -o /cygdrive/c/DOCUME~1/THOMASP/LOC
ALS~1/Temp/ccmHx843.s
GNU F95 version 3.5.0 20040815 (experimental) (i686-pc-cygwin)
        compiled by GNU C version 3.5.0 20040719 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 as -o /cygdrive/c/DOCUME~1/THOMASP/LOCALS~1/Temp/ccMLSMd2.o /cygdrive/c/DOCUME~
1/THOMASP/LOCALS~1/Temp/ccmHx843.s
 /irun/libexec/gcc/i686-pc-cygwin/3.5.0/collect2.exe -Bdynamic --dll-search-pref
ix=cyg /lib/crt0.o -L/irun/lib/gcc/i686-pc-cygwin/3.5.0 -L/irun/lib/gcc/i686-pc-
cygwin/3.5.0/../../.. /cygdrive/c/DOCUME~1/THOMASP/LOCALS~1/Temp/ccMLSMd2.o -lgf
ortranbegin -lgfortran -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -
lgcc
 1st READ is OK
&mynml
number=         42,/
 2nd READ is OK
&mynml
number=         42,/
At line 29 of file bug2.f90
Fortran runtime error: End of file

-- 
           Summary: namelist write does not terminate with &end
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paul dot richard dot thomas at cea dot fr
                CC: gcc-bugs at gcc dot gnu dot org,paulthomas2 at wanadoo
                    dot fr


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]