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/49597] New: gfortran namelist read bug


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

           Summary: gfortran namelist read bug
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: david.sagan@gmail.com


Test program is:

program the_bug

implicit none

type example_struct
  logical logic
end type example_struct

integer readstatus
type(example_struct) fzz(3)
namelist /parameters/ fzz
!
open (unit= 10,file='the_bug.in')
read(10, nml = parameters,iostat=readstatus)
write(*,*) "iostat = ", readstatus
end program the_bug


Input file "the_bug.in" is:

&parameters 
fzz(1)%logic = .true.
fzz(2)%logic = .true.
/

bla bla bla


Running gives:

/lnx4103:~/dcs/bmad_distribution/test> gfortran --version
GNU Fortran (GCC) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

lnx4103:~/dcs/bmad_distribution/test> gfortran test.f90 ; ./a.out
 iostat =         5010


iostat should be 0. 
If you delete the "bla bla bla" line you get iostat = -1. 
If you change the name of the variable from "fzz" to, say, "zz" (2 places in
the program and 2 places in the_bug.in) you get iostat as 0 as it should be.
I have not tried extensively to test this but variable names beginning with "t"
and variable names beginning with "f" show the bug and other names do not.


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