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/22010] New: Namelists defined in modules not handled properly


The following code (where input.dat is a file that does not
contain a debugging namelist entry) goes wrong:

MODULE debug
  LOGICAL debug_area
  NAMELIST/debugging/debug_area
END MODULE debug

PROGRAM ding
  USE debug
  IMPLICIT NONE
  INTEGER :: ios
  OPEN(unit=10, status='unknown', file='input.dat')
  READ(unit=10, nml=debugging,  iostat=ios)
  PRINT*, 'nml=debugging',ios
END PROGRAM ding

$ gfortran -o namelistding namelistding.f90 && ./namelistding
 nml=debugging          2

The following works properly:

PROGRAM ding
  IMPLICIT NONE
  LOGICAL debug_area
  NAMELIST/debugging/debug_area
  INTEGER :: ios
  OPEN(unit=10, status='unknown', file='input.dat')
  READ(unit=10, nml=debugging,  iostat=ios)
  PRINT*, 'nml=debugging',ios
END PROGRAM ding

$ gfortran -o namelistding namelistding.f90 && ./namelistding
 nml=debugging          -1

More interesting, the following also works:

MODULE debug
  LOGICAL debug_area
  NAMELIST/debugging/debug_area
END MODULE debug

PROGRAM ding
  USE debug
  IMPLICIT NONE
  NAMELIST/debugging/debug_area
  INTEGER :: ios
  OPEN(unit=10, status='unknown', file='input.dat')
  READ(unit=10, nml=debugging,  iostat=ios)
  PRINT*, 'nml=debugging',ios
END PROGRAM ding

$ gfortran -o namelistding namelistding.f90 && ./namelistding
 nml=debugging          -1

-- 
           Summary: Namelists defined in modules not handled properly
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at chatsubo dot lagged dot za dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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