I get a segmentation fault when trying to execute the following simple program: >cat junk2.f program junk character*28000 s do i=1,28000 s(i:i) = 'a' end do open(3,file='junk_file',form='unformatted',access='direct', & recl=28000) write(3,rec=1) s end >gfortran junk2.f >./a.out Segmentation fault I think, the problem can be traced back to mmap_alloc(), where the size of the allocated memory is calculated as length = ((where - offset) & page_mask) + 2 * page_size; and turns out to be 8192 bytes on my system, with no checks being made to see if this is large enough for the actual data size. The subsequent memcpy in unformatted_write leads to segmentation fault. The fix is trivial (allocate enough memroy in mmap_alloc), unless there are considerations concerning the maximum memory use of the runtime library.
This is fixed in 4.1.0 by removing the mmap code.