I have a program which works well when using Macbook, but as soon as I try it on PC with Fedora 28, I get this error:
At line 107 of file transport.f08
Fortran runtime error: End of record
Error termination. Backtrace:
#0 0x7f2e56fe039a
#1 0x7f2e56fe0f09
#2 0x7f2e56fe1711
#3 0x7f2e571e6818
#4 0x7f2e571f2022
#5 0x7f2e571e97fa
#6 0x7f2e571e9c14
#7 0x403e5a
#8 0x405d0c
#9 0x405e65
#10 0x7f2e5643b1ba
#11 0x400bc9
#12 0xffffffffffffffff
Here is the block of code with problematic line 107:
subroutine outputs(i_out)
integer, intent(in) :: i_out
integer :: iunit, ierr
integer :: i
character(len=8) :: chout
write(chout,fmt='(I0.4)') i_out ! LINE 107
open(newunit=iunit,file="./outputs/Houtput"//trim(chout)//".dat",&
action="write", iostat=ierr)
if( ierr /= 0) then
print *, " > There was an error while opening output file ", i_out
print *, " > Exiting..."
stop
endif
do i=1,Nr
write(iunit,fmt='(20E14.6)') r_cell(i), velocity(i), pressure(i), density(i)
enddo
close(iunit)
end subroutine outputs
As francescalus pointed out in the comments, I had to drop i_out length to 8 or less digits. It solved the error.
I still don't know why it worked on Mac before, but having the error solved is enough for me :) Thanks.