https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98129

            Bug ID: 98129
           Summary: Failure on reading big chunk of /dev/urandom
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

The following program

program main
  implicit none
  integer, parameter :: n = 10**7
  integer :: u,v
  integer, dimension(:), allocatable :: a
  open (newunit=u,file="/dev/urandom",form="unformatted",access="stream")
  open (newunit=v,file="/dev/null",form="unformatted",access="stream")
  allocate (a(n))
  read (u) a
  write (v) a
end program main

fails on Linux with

At line 9 of file read.f90
Fortran runtime error: End of file

Error termination. Backtrace:
#0  0x7fa9c7be372f in read_block_direct
        at ../../../trunk/libgfortran/io/transfer.c:664
#1  0x7fa9c7be372f in unformatted_read
        at ../../../trunk/libgfortran/io/transfer.c:1127
#2  0x400bf3 in ???
#3  0x400c9c in ???
#4  0x7fa9c6e64349 in __libc_start_main
        at ../csu/libc-start.c:308
#5  0x400909 in ???
        at ../sysdeps/x86_64/start.S:120
#6  0xffffffffffffffff in ???

Reply via email to