I don't know if this is an actual regression but using gcc-4.0.2 
built with:

$ ../gcc-4.0.2/configure --prefix=/opt/gcc-4.0.2 \
  --enable-languages=c,c++,f95 --program-suffix=-4.0.2

the program:

$ cat diag.f
      program diag
      INTEGER nd
      PARAMETER ( nd = 5 )
      CHARACTER*(8) names(nd,nd)
      NAMELIST / diags /  names
      OPEN(UNIT=20,FILE='diag.nml',STATUS='OLD')
      READ(20,NML=diags)
      WRITE(*,NML=diags)
      STOP
      END

will work with:

$ cat diag.nml
&DIAGS
 NAMES = 'ETAN' 'ETANSQ' 'DETADT2' 'PHIBOT' 'PHIBOTSQ' '' ''
 '' '' '' '' '' '' ''
 '' '' '' '' '' '' ''
 '' '' '' ''/

but fails with the message:

$ ./diag
At line 7 of file diag.f
Fortran runtime error: Cannot match namelist object name 'etansq

when reading:

$ cat diag.nml
 &diags
   names(1,1) = 'ETAN    ','ETANSQ  ','DETADT2 ','PHIBOT  ','PHIBOTSQ',
/

The reason that it appears to be a regression is that both namelist 
files work nicely with basically all g77 versions shipped in recent 
years and with a large number of both past and present commercial 
Fortran compilers including Intel v5--v9, PGI, IBM xlf, and Sun.

In my (humble!) opinion, it would be a shame if the namelist indexing 
("implicit" indexing?) is lost since large namelist files are more 
legible using it.  And, existing namelist files will require a fairly
substantial amount of editing to convert between the two types of 
formatting.


-- 
           Summary: gfortran namelist regression
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ed at eh3 dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to