@@ -60,7 +60,7 @@ subroutine getline(unit, line, iostat, iomsg)
6060 integer , intent (out ) :: iostat
6161
6262 ! > Error message
63- character (len= :), allocatable , optional :: iomsg
63+ character (len= :), allocatable , intent ( out ), optional :: iomsg
6464
6565 integer , parameter :: bufsize = 512
6666 character (len= bufsize) :: buffer
@@ -109,7 +109,7 @@ subroutine next_line(unit, line, pos, lnum, iostat, iomsg)
109109 integer , intent (out ) :: iostat
110110
111111 ! > Error message
112- character (len= :), allocatable , optional :: iomsg
112+ character (len= :), allocatable , intent ( out ), optional :: iomsg
113113
114114 pos = 0
115115 call getline(unit, line, iostat, iomsg)
@@ -405,7 +405,9 @@ subroutine read_token_int(line, token, val, iostat, iomsg)
405405 character (len= 512 ) :: msg
406406
407407 if (token% first > 0 .and. token% last <= len (line)) then
408+ val = 0
408409 read (line(token% first:token% last), * , iostat= iostat, iomsg= msg) val
410+ if (iostat /= 0 ) val = 0
409411 else
410412 iostat = 1
411413 msg = " No input found"
@@ -437,7 +439,9 @@ subroutine read_token_real(line, token, val, iostat, iomsg)
437439 character (len= 512 ) :: msg
438440
439441 if (token% first > 0 .and. token% last <= len (line)) then
442+ val = 0.0_wp
440443 read (line(token% first:token% last), * , iostat= iostat, iomsg= msg) val
444+ if (iostat /= 0 ) val = 0.0_wp
441445 else
442446 iostat = 1
443447 msg = " No input found"
0 commit comments