https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436
Bug ID: 83436
Summary: Internal file cannot be accessed by UNFORMATTED data
transfer when reading from /dev/urandom
Product: gcc
Version: 7.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: daanvanvugt at gmail dot com
Target Milestone: ---
With the update to 7.2.1 the following code fragment starts failing:
Fortran runtime error: Internal file cannot be accessed by UNFORMATTED data
transfer
!> Read an int from /dev/urandom
subroutine read_urandom_int(seed, ierr)
implicit none
integer, intent(out) :: seed
integer, intent(out) :: ierr
integer :: un
open(newunit=un, file="/dev/urandom", access="stream", &
form="unformatted", action="read", status="old", iostat=ierr)
if (ierr == 0) then
read(un) seed
close(un)
end if
end subroutine read_urandom_int
I think this might be a regression. The same code works just fine in intel
compiler and older gfortran versions.