NCAR / DART

Data Assimilation Research Testbed
https://dart.ucar.edu/
Apache License 2.0
187 stars 140 forks source link

bug: Derecho ifort 2021 invalid namelist prints wrong line #578

Closed hkershaw-brown closed 8 months ago

hkershaw-brown commented 9 months ago

:bug: 🦝

Describe the bug

  1. List the steps someone needs to take to reproduce the bug.

build utilities developer tests /developer_tests/utilities/work/ put an invalid entry in the input.nml cheese = 'cake', run ./nml_test

  1. What was the expected outcome? INVALID NAMELIST ENTRY: cake = 'cheese' in namelist utilities_nml

  2. What actually happened?
    INVALID NAMELIST ENTRY: module_details = .false., in namelist utilities_nml

Error Message

On Derecho

(main)$ head -n5 input.nml  
&utilities_nml
   cheese = 'cake',
   module_details = .false.,
   write_nml = 'none'
/

./nml_test 
 FATAL ERROR in check_namelist_read
  INVALID NAMELIST ENTRY:    module_details = .false., in namelist utilities_nml
   utilities_mod.f90
    stopping.

ifort --version
ifort (IFORT) 2021.8.0 20221119
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

Compare to ifort on my laptop:

hkershaw@cisl-fisher work (main) $ head -n 5 input.nml 
&utilities_nml
   cake = 'cheese'
   module_details = .false.,
   write_nml = 'none'
/
hkershaw@cisl-fisher work (main) $ ./nml_test 
 FATAL ERROR in check_namelist_read
  INVALID NAMELIST ENTRY:    cake = 'cheese' in namelist utilities_nml
   utilities_mod.f90
    stopping.

ifort --version
ifort (IFORT) 2021.5.0 20211109
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

Which model(s) are you working with?

All of them

Version of DART

Which version of DART are you using? You can find the version using git describe --tags
v10.9.1

Have you modified the DART code?

nope

Build information

Derecho intel

hkershaw-brown commented 9 months ago

gfortran and nvhpc give the correct line. Looking like an intel problem.

hkershaw-brown commented 9 months ago

small repoducer:

$ cat test_namelist_backspace.f90 
program test_backspace

implicit none

integer :: ios, iunit
character(len=5) :: one, two, three, four, line
namelist /nums_nml/ one, two, three, four

one = 'nope'
two = 'nope'
three = 'nope'
four = 'nope'

open(newunit=iunit, file='input.nml', action='read', iostat=ios)
read(iunit, nml=nums_nml, iostat=ios)
print*, one, two, three, four

print*, 'iostat', ios
if (ios /= 0) then 
   backspace(iunit)
   read(iunit, '(A)') line
   print*, 'bad line: ', line
endif

close(iunit)

end program test_backspace
$cat input.nml 
&nums_nml
one = 'one',
two = 'two',
cake = 'three'
four = 'four'
/
$ gfortran test_namelist_backspace.f90
$ ./a.out 
 one  two  nope nope 
 iostat        5010
 bad line: cake 
$ ifort test_namelist_backspace.f90 
$./a.out 
 one  two  nope nope 
 iostat          19
 bad line: four 

posted in intel forum

hkershaw-brown commented 8 months ago

closing, see https://community.intel.com/t5/Intel-Fortran-Compiler/backspace-with-namelist-read/m-p/1548510#M169536

nancycollins commented 8 months ago

that's too bad - it's always worked up to now. perhaps as a bandaid we can change the 'bad line: ' label somehow to indicate it might be the line before this one. suggestion: bad line is near: xxxx or bad line is close to: xxx