aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2016-08-19 17:12:32 +0300
committerJanne Blomqvist <jb@gcc.gnu.org>2016-08-19 17:12:32 +0300
commit91151a7334543817f1f790310a1bfc4589889cad (patch)
tree3dd25be020bc1f538120f175d6ec7627ccda7699 /gcc
parentf0c90610e3e0646b89ae3e4b20134dc7e1cd7d12 (diff)
downloadgcc-91151a7334543817f1f790310a1bfc4589889cad.zip
gcc-91151a7334543817f1f790310a1bfc4589889cad.tar.gz
gcc-91151a7334543817f1f790310a1bfc4589889cad.tar.bz2
Always initialize PRNG using random data from the OS.
libgfortran: 2016-08-16 Janne Blomqvist <jb@gcc.gnu.org> * intrinsics/random.c (master_init): New variable. (init_rand_state): Move below getosrandom (), maybe initialize master_state. (random_seed_i4): If called with no arguments, set master_init to false, and reinitialize. If called with PUT=, set master_init to true. (random_seed_i8): Likewise. testsuite: 2016-08-16 Janne Blomqvist <jb@gcc.gnu.org> * gfortran.dg/random_4.f90: Initialize seed before using, handle the last special seed value. * gfortran.dg/random_7.f90: Use size for last array member instead of hardcoded value. From-SVN: r239611
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gfortran.dg/random_4.f903
-rw-r--r--gcc/testsuite/gfortran.dg/random_7.f905
3 files changed, 13 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6590fab..3807dd5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-19 Janne Blomqvist <jb@gcc.gnu.org>
+
+ * gfortran.dg/random_4.f90: Initialize seed before using, handle
+ the last special seed value.
+ * gfortran.dg/random_7.f90: Use size for last array member instead
+ of hardcoded value.
+
2016-08-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gcc.dg/cpp/warn-undef.c: Append "evaluates to 0" to dg-error.
diff --git a/gcc/testsuite/gfortran.dg/random_4.f90 b/gcc/testsuite/gfortran.dg/random_4.f90
index 416b17c..e60698f 100644
--- a/gcc/testsuite/gfortran.dg/random_4.f90
+++ b/gcc/testsuite/gfortran.dg/random_4.f90
@@ -6,8 +6,11 @@ program trs
integer, allocatable, dimension(:) :: seed, check
call test_random_seed(size)
allocate(seed(size),check(size))
+ seed = 42
call test_random_seed(put=seed)
call test_random_seed(get=check)
+ ! With xorshift1024* the last seed value is special
+ seed(size) = check(size)
if (any (seed /= check)) call abort
contains
subroutine test_random_seed(size, put, get)
diff --git a/gcc/testsuite/gfortran.dg/random_7.f90 b/gcc/testsuite/gfortran.dg/random_7.f90
index aafe346d..8cd9c43 100644
--- a/gcc/testsuite/gfortran.dg/random_7.f90
+++ b/gcc/testsuite/gfortran.dg/random_7.f90
@@ -10,8 +10,9 @@ program trs
seed(:) = huge(seed) / 17
call test_random_seed(put=seed)
call test_random_seed(get=check)
- ! In the current implementation seed(17) is special
- seed(17) = check(17)
+ ! In the current xorshift1024* implementation the last seed value is
+ ! special
+ seed(size) = check(size)
if (any (seed /= check)) call abort
contains
subroutine test_random_seed(size, put, get)