RISC-V: Regenerate opt urls.
[official-gcc.git] / gcc / testsuite / gfortran.dg / internal_readwrite_4.f90
blobcd2e684a45600f37f45453db166d20a3b46797f0
1 ! { dg-do run }
2 ! PR 83436 - this used to cause an error.
3 ! Original test case by Daan van Vugt.
4 module mod_random_seed
5 implicit none
6 contains
7 !> Read an int from /dev/urandom
8 subroutine read_urandom_int(seed, ierr)
9 implicit none
10 integer, intent(out) :: seed
11 integer, intent(out) :: ierr
12 integer :: un
13 character(len=80) :: restart_file
14 write(restart_file,'(A,A)') 'jorek', '_restart.h5'
16 open(newunit=un, file="/dev/urandom", access="stream", &
17 form="unformatted", action="read", status="old", iostat=ierr)
18 if (ierr == 0) then
19 read(un) seed
20 close(un)
21 end if
22 end subroutine read_urandom_int
23 end module mod_random_seed
25 program test_random_seed
26 use mod_random_seed
27 implicit none
28 integer :: seed, ierr
29 call read_urandom_int(seed, ierr)
30 end program test_random_seed