This PR is branched from PR25697 and appears to be a problem in fd_alloc related to setting s->active = 0 when it should not for buffer sizes greater than 8192 bytes. The following test case appears to not fail when the data array is 2044 elements ans gives a runtime when 2045. This is the 8192 byte crossover point (2044 x 4 + 16 for record markers)
The test case also involves EOF conditions. integer data(2045) do i = 1,2045 data(i)=-2 enddo open(unit=11,status='scratch',form='unformatted') write(11)data read(11,end= 1000 )data call abort() 1000 continue print *, "First read done." backspace 11 backspace 11 read(11,end= 1001 )data print *, "Second read normal exit." 1001 continue read(11,end= 1002 )data call abort() 1002 continue print *, "Third read done." close(11) end -- Summary: Segfault or Bad Address error on unformatted sequential READ Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: jvdelisle at gcc dot gnu dot org ReportedBy: jvdelisle at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25835