Rejects valid: list-directed input with newline characters

The following program should print “1”:

program main
  integer :: x
  character(len=10) :: s
  s = ' ' // achar(10) // '1'
  read(s, *) x
  print *, x
end program main

However, when I try to compile this with PGI 17.4 community edition, I get the following error:

FIO-F-217/list-directed read/internal file/attempt to read past end of file.
 In source file readnl.f90, at line number 5

This example works fine with both gfortran and ifort.

Paul,

We have replicated and assigned TPR 24283 to the issue.

thanks,
dave

24283 - Fortran Fatal Error ‘list-directed read/internal file/attempt to read past end of file.’

has been fixed in the 17.10 release.

dave