https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83525
Bug ID: 83525 Summary: open(newunit=funit, status="scratch") fails if an internal file (characters) was read previously. Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: lainme993 at gmail dot com Target Milestone: --- I found the following code fails to execuate after upgrading to gfortran 7.2.1. This problem doesn't exist in gfortran 7.2.0. program main integer :: funit logical :: isopen integer :: this, another character(len=:), allocatable :: message message = "12" read(message, *) this open(newunit=funit, status="scratch") write(funit, *) "13" rewind(funit) read(funit, *) another write(*,*) another end The above code gives At line 13 of file test.f90 Fortran runtime error: End of file Error termination. Backtrace: #0 0x7fa882a8d2d4 in write_char at /build/gcc/src/gcc/libgfortran/io/write.c:1275 #1 0x7fa882a92641 in list_formatted_write_scalar at /build/gcc/src/gcc/libgfortran/io/write.c:1867 #2 0x555fb001ec14 in ??? #3 0x555fb001ed7f in ??? #4 0x7fa881db9f49 in ??? #5 0x555fb001e9c9 in ??? #6 0xffffffffffffffff in ??? If I remove the line "read(mesage, *)this", the remaning part runs fine and gives the correct result "13".