When compiling below reproducer and running it with the opened file not being there, the executable core dumps:
$ flang-new -o readtest ./readtest.f90
$ ./readtest
fatal Fortran runtime error(/path/path/path/readtest.f90:9): End of file during input
[1] 1099765 IOT instruction (core dumped) ./readtest
The expected output would be:
Reproducer:
program readtest
implicit none
character(len=10) :: dir_app
real(8) :: rdum, rispin
integer :: idum
open(unit=12, file='data1.dat', access='direct', form='unformatted',status='unknown', recl=128)
read(12,rec=1,err=17421) rdum,rispin ; idum=nint(rdum)
write (*,*) rdum, rispin
return
17421 write(*,*) "ERROR"
end program