Cf. http://gcc.gnu.org/ml/fortran/2007-02/msg00145.html

The following code is invalid Fortran as the USE-associated NAMELIST is
respecified in the main program:
----------------------------
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 and Portland group Fortran accept it by default, while xlf, ifort, NAG
f95 and g95 reject it by default.

Note that gfortran rejects it with -std=f2003:

Error: Namelist group name 'debugging' at (1) already is USE associated
and cannot be respecified.

Should the GFC_STD_GNU be changed into GFC_STD_LEGACY?
Or should there be a warning only for -std=gnu (= default option)?
Or keep status quo?


-- 
           Summary: Warn by default when respecifiying USE associated
                    NAMELIST
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to