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 libfortran/34530] New: [4.3 regression] namelist read broken when whitespace after &namelist


Hi,

namelist read was broken between

GNU Fortran (GCC) 4.3.0 20071216 (experimental) [trunk revision 130986]
(works)

GNU Fortran (GCC) 4.3.0 20071217 (experimental) [trunk revision 131004]
(fails).

This is likely due to the patch for PR34427.

Example: the code below now gives

At line 17 of file gfcbug77.f90 (unit = 10, file = 'gfcbug77.nml')
Fortran runtime error: Cannot match namelist object name !

Backtrace for this error:
  + function translate_error (0x804A2A1)
    at line 311 of file error.c
  + function finalize_transfer (0x804DF79)
    at line 2626 of file transfer.c
  + function gfcbug77 (0x804983C)
    at line 17 of file gfcbug77.f90
  + /lib/libc.so.6(__libc_start_main+0xe0) [0x40071fe0]

% cat gfcbug77.f90
program gfcbug77
  implicit none

  character(len=128) :: file = ""
  logical            :: default
  namelist /BLACKLIST/ file, default

  integer, parameter :: nnml = 10

  open (nnml, file='gfcbug77.nml')
  write(nnml,*) "&blacklist "           ! The trailing space breaks gfortran
  write(nnml,*) "  ! This is a comment within the namelist"
  write(nnml,*) "  file    = 'myfile'"
  write(nnml,*) "  default = F"
  write(nnml,*) "/"
  rewind(nnml)
  read (nnml, nml=BLACKLIST)
  close(nnml)
  write (*,nml=BLACKLIST)
end program gfcbug77

Removing the marked whitespace or removing the comment line
within the namelist lets the program run.

Cheers,
-ha


-- 
           Summary: [4.3 regression] namelist read broken when whitespace
                    after &namelist
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de


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


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