https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98129
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- The problem seems to be related to an early return from the read system call: strace -e trace=open,read,close ./a.out read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\v\2\0\0\0\0\0"..., 832) = 832 close(3) = 0 close(3) = 0 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\217\0\0\0\0\0\0"..., 832) = 832 close(3) = 0 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260/\0\0\0\0\0\0"..., 832) = 832 close(3) = 0 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@*\0\0\0\0\0\0"..., 832) = 832 close(3) = 0 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`D\2\0\0\0\0\0"..., 832) = 832 close(3) = 0 read(3, ":\312\275\302\373|\204[c`\20\275\230\205\326@\255Mj\263-qd\336\30\300\2G\326\215\333J"..., 40000000) = 33554431 At line 9 of file read.f90 Fortran runtime error: End of file Error termination. Backtrace: close(5) = 0 close(5) = 0 close(6) = 0 close(5) = 0 close(5) = 0 close(5) = 0 close(6) = 0 close(5) = 0 close(6) = 0 close(5) = 0 #0 0x7fd9847c572f in read_block_direct at ../../../trunk/libgfortran/io/transfer.c:664 #1 0x7fd9847c572f in unformatted_read at ../../../trunk/libgfortran/io/transfer.c:1127 #2 0x400bf3 in ??? #3 0x400c9c in ??? #4 0x7fd983a46349 in __libc_start_main at ../csu/libc-start.c:308 #5 0x400909 in ??? at ../sysdeps/x86_64/start.S:120 #6 0xffffffffffffffff in ??? close(4) = 0 close(3) = 0 +++ exited with 2 +++