Bugreport: nvfortran 25.5 and after “FIO-F-233/namelist read/too many constants to initialize group item”

Hi,

When using recent nvfortran compiler, 25.5 and after, FIO-F-233/namelist read error occurred. Following is a code example to reproduce this issue, test.f.

  integer ios
  integer, parameter :: spc_dim = 2
  TYPE SPECIES_DATA_REG_1
      CHARACTER( 16 ) :: SPECIES_NAME  ! CMAQ Species Name
      REAL            :: MOLWT         ! g mol-1
      CHARACTER( 16 ) :: IC_SURR       ! IC Surrogate
      REAL            :: IC_FAC        ! IC Scale Factor
      CHARACTER( 16 ) :: BC_SURR       ! BC Surrogate
      REAL            :: BC_FAC        ! BC Scale Factor
      CHARACTER( 16 ) :: DEPV_SURR     ! Dry Deposition Surrogate
      REAL            :: DEPV_FAC      ! Dry Deposition Scale Factor
      CHARACTER( 16 ) :: SCAV_SURR     ! Wet Scavenging Surrogate
      REAL            :: SCAV_FAC      ! Wet Scavenging Scale Factor
      CHARACTER( 16 ) :: AERO_SURR     ! Aerosol Module Surrogate
      CHARACTER( 16 ) :: CLOUD_SURR    ! Cloud Chemistry Surrogate
      CHARACTER( 16 ) :: TRNS_FLAG     ! Do Transport (ADV + DIFF)?
      CHARACTER( 16 ) :: DDEP_FLAG     ! Output Dry Deposition Velocities
      CHARACTER( 16 ) :: WDEP_FLAG     ! Output Wet Scavenging Fluxes
      CHARACTER( 16 ) :: CONC_FLAG     ! Output Concentration
  END TYPE SPECIES_DATA_REG_1
  TYPE (SPECIES_DATA_REG_1), ALLOCATABLE :: GC_SPECIES_DATA(:)
  namelist / GC_NML / GC_SPECIES_DATA
  ALLOCATE( GC_SPECIES_DATA( SPC_DIM ), STAT=IOS )

  open( file = 'GC_cb6r5_ae7_aq.nml', unit = 20, status = 'old')
        read( nml = GC_nml, unit = 20 )
  write(*,nml=GC_nml)
  stop
  end

Content of file GC_cb6r5_ae7_aq.nml

&GC_nml
GC_SPECIES_DATA =
‘NO2’ , 46.0 ,‘’ ,-1 ,‘’ ,-1 ,‘VD_NO2’ , 1 ,‘NO2’ , 1 ,‘NO2’ ,‘’ ,‘Yes’ ,‘Yes’ ,‘Yes’ ,‘Yes’,
‘NO’ , 30.0 ,‘’ ,-1 ,‘’ ,-1 ,‘VD_NO’ , 1 ,‘NO’ , 1 ,‘’ ,‘’ ,‘Yes’ ,‘Yes’ ,‘Yes’ ,‘Yes’,
/

Compiling and running logs of 25.3(success)

$ pgfortran --version

pgfortran (aka nvfortran) 25.3-0 64-bit target on x86-64 Linux -tp znver5
PGI Compilers and Tools
Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
$ pgfortran test.f
$ ./a.out
&GC_NML
GC_SPECIES_DATA = NO2 ,
46.00000 ,
,
-1.000000 ,
,
-1.000000 ,
VD_NO2 ,
1.000000 ,
NO2 ,
1.000000 ,
NO2 ,
,
Yes ,
Yes ,
Yes ,
Yes ,
NO ,
30.00000 ,
,
-1.000000 ,
,
-1.000000 ,
VD_NO ,
1.000000 ,
NO ,
1.000000 ,
,
,
Yes ,
Yes ,
Yes ,
Yes
/
FORTRAN STOP

Compiling and running logs of 25.3 and after(fail)

$ pgfortran --version

pgfortran (aka nvfortran) 25.5-0 64-bit target on x86-64 Linux -tp znver5
PGI Compilers and Tools
Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
$ pgfortran test.f
$ ./a.out
FIO-F-233/namelist read/unit=20/too many constants to initialize group item.
File name = ‘GC_cb6r5_ae7_aq.nml’, formatted, sequential access record = 4
In source file test.f, at line number 26

Please fix this or tell me a workaround way. Thanks in advance.

an

Thanks for the report nogami!

I can recreate the error here, though 25.3 fails the same way for me, so I’m not sure why it’s working for you. Though, I went ahead and added an issue report, TPR #38620, and sent to engineering for review.

The work around is to update the namelist file so the compiler knows that there are multiple records, i.e. change “GC_SPECIES_DATA” to “GC_SPECIES_DATA(:)”. This should still be ok for other compilers as well.

% cat GC_cb6r5_ae7_aq.nml
&GC_nml
GC_SPECIES_DATA(:) =
'NO2' , 46.0 ,' ' ,-1 ,' ' ,-1 ,'VD_NO2' , 1 ,'NO2' , 1 ,'NO2' ,' ' ,'Yes' ,'Yes' ,'Yes' ,'Yes'
'NO' , 30.0 ,' ' ,-1 ,' ' ,-1 ,'VD_NO' , 1 ,'NO' , 1 ,' ' ,' ' ,'Yes' ,'Yes' ,'Yes' ,'Yes',
/
% nvfortran test.f;  ./a.out
 &GC_NML
 GC_SPECIES_DATA = NO2             ,
                      46.00000    ,
                                   ,
                     -1.000000    ,
                                   ,
                     -1.000000    ,
                   VD_NO2          ,
                      1.000000    ,
                   NO2             ,
                      1.000000    ,
                   NO2             ,
                                   ,
                   Yes             ,
                   Yes             ,
                   Yes             ,
                   Yes             ,
                   NO              ,
                      30.00000    ,
                                   ,
                     -1.000000    ,
                                   ,
                     -1.000000    ,
                   VD_NO           ,
                      1.000000    ,
                   NO              ,
                      1.000000    ,
                                   ,
                                   ,
                   Yes             ,
                   Yes             ,
                   Yes             ,
                   Yes
 /
FORTRAN STOP

-Mat

Hi Mat,

I confirmed FIO-F-233 error vanished by changing the namelist file. Thanks show me the workaround. On the compiler version, I used RockyLinux 10.1 and also nvfortran 23.1 and 23.3 work well with original namelist file. Beside, nvfortran 25.3 on another PC with Rocky Linux 9.5 works.

Actually, the example code is a part of very huge WRF-CMAQ program and I do not want change the source code package including many namelist files if possible, because any versions of gfortran and ifx compiler work with no error. However, nvfortran can generate faster code than them, so I hope future release of nvfortran will resolve this issu .

an