re PR fortran/63570 ([F2018] Implement 13.7.137 RANDOM INIT (REPEATABLE, IMAGE DISTINCT))
[official-gcc.git] / gcc / testsuite / gfortran.dg / random_init_6.f90
blobe8d91d8accfa0dca55c2635d979b1028a8abe58a
1 ! { dg-do run }
2 ! { dg-options "-fcoarray=single" }
3 program rantest
5 implicit none
7 logical, parameter :: debug = .false.
8 character(len=20) name
9 integer fd, i, n
10 integer, allocatable :: n1(:), n2(:), n3(:)
11 real x(4), y(4), z(4)
13 if (debug) then
14 write(name,'(A,I0)') 'dat', this_image()
15 open(newunit=fd, file=name)
16 end if
18 call random_seed(size=n)
19 allocate(n1(n), n2(n), n3(n))
21 call random_init(.false., .true.)
22 call random_seed(get=n1)
23 call random_number(x)
25 call random_init(.false., .true.)
26 call random_seed(get=n2)
27 call random_number(y)
29 call random_init(.false., .true.)
30 call random_seed(get=n3)
31 call random_number(z)
33 if (debug) then
34 write(fd,'(A,4F12.6)') 'x = ', x
35 write(fd,'(A,4F12.6)') 'y = ', y
36 write(fd,'(A,4F12.6)') 'z = ', z
37 write(fd,*)
38 do i = 1, 5
39 write(fd,'(I2,4I13)') i, n1(i), n2(i), n3(i)
40 end do
41 end if
43 end program rantest