[gfortran] PATCH -- Fix segfault in RANDOM_SEED.

Steven G. Kargl kargls@comcast.net
Sun May 23 16:05:00 GMT 2004


This patch fixes a segfault when using the PUT 
argument of RANDOM_SEED.  There, however, is a
major problem with the current PRNG.  This 
simple program appears to trigger an alarmingly
bad sequence of numbers.

   program s
   integer, allocatable :: a(:)
   integer i,n
   real x(10)
   call random_seed(size=n)
   allocate(a(n))
   a = (/ (i, i = 1, n) /)
   call random_seed(put=a)
   call random_number(x)
   do i = 1, 10
      print '(I2,2X,E15.6)', i, x(i)
   end do
   end program s

kargl[212] ./s
 1     0.928994E-07
 2     0.597788E+00
 3     0.935979E-07
 4     0.597788E+00
 5     0.933650E-07
 6     0.597788E+00
 7     0.931322E-07
 8     0.597788E+00
 9     0.938307E-07
10     0.597788E+00


2004-05-23  Steven G. Kargl  <kargls@comcast.net>
    * random.c (random_seed): Use correct variable.

-- 
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random.c.diff
Type: application/octet-stream
Size: 506 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20040523/c377a4a7/attachment.obj>


More information about the Fortran mailing list