This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/15619] New: random_seed(get) affects sequence of numbers


Calling the random_seed intrinsic to get the seed should affects the following 
sequence of numbers. I'm not sure if this is explicitly illegal, but it's 
definitely very surprising behaviour. 
The following program should print two identical lines: 
program prog 
  integer, allocatable :: a(:) 
  integer i,n 
  real w, x, y, z 
  call random_seed(size=n) 
  allocate(a(n)) 
  call random_seed(get=a) 
  call random_number(w) 
  call random_number(x) 
  call random_seed(put=a) 
  call random_number(y) 
  call random_seed(get=a) 
  call random_number(z) 
  print *, w, x 
  print *, y, z 
end program

-- 
           Summary: random_seed(get) affects sequence of numbers
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pbrook at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15619


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]