re PR libfortran/15149 (problem computing Pi)
authorBud Davis <bdavis9659@comcast.net>
Fri, 14 May 2004 12:21:22 +0000 (12:21 +0000)
committerBud Davis <bdavis@gcc.gnu.org>
Fri, 14 May 2004 12:21:22 +0000 (12:21 +0000)
        PR fortran/15149
        * gfortran.fortran-torture/execute/random_init.f90: New test.
        * libgfortan.h,intrinsics/random.c: Made random_seed visible.
        * runtime/main.c(init): Call random_seed as part of MAIN init.

From-SVN: r81836

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/random_init.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/intrinsics/random.c
libgfortran/libgfortran.h
libgfortran/runtime/main.c

index 4ac96daa5626b400bee4602f61eac8d88087dcbb..c3a62881facbbe870ffbb545d4f69ee4a072edd0 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-14  Bud Davis  <bdavis9659@comcast.net>
+
+       PR fortran/15149
+       * gfortran.fortran-torture/execute/random_init.f90: New test.
+
 2004-05-13  Paul Brook  <paul@codesourcery.com>
 
        PR fortran/15314
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/random_init.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/random_init.f90
new file mode 100644 (file)
index 0000000..3639458
--- /dev/null
@@ -0,0 +1,11 @@
+! pr 15149
+! verify the random number generator is functional
+      program test_random
+      implicit none
+      real :: r(5) = 0.0
+
+      call random_number(r)
+      if (all (r .eq. 0)) call abort
+      end program
+
+
index 7df9edf3f6c73f982ba428b1335c3f64f1eade83..bbf22d4d08228a0a33b6448daccd95908e677ce9 100644 (file)
@@ -1,3 +1,9 @@
+2004-05-14  Bud Davis  <bdavis9659@comcast.net>
+
+       PR fortran/15149
+       * libgfortan.h,intrinsics/random.c: Made random_seed visible.
+       * runtime/main.c(init): Call random_seed as part of MAIN init.
+
 2004-05-13  Tobias Schlüter  <tobias.schlueter@physik.uni-muenchen.de>
 
        * io/format.c: (parse_format_list): No comma is required after
index b578148f46964e794184e76d6e8be0a148ed6164..120c9517fa2f11b69b797f295d8a3f42f662b5e9 100644 (file)
@@ -70,7 +70,6 @@ static unsigned int seed[N];
 /* This is the routine which handles the seeding of the generator,
    and also reading and writing of the seed.  */
 
-#define random_seed prefix(random_seed)
 void
 random_seed (GFC_INTEGER_4 * size, const gfc_array_i4 * put,
             const gfc_array_i4 * get)
index 14a217a64f6c09f280f15f4c54d222269417507a..112fd075dcf8fa04b06f0ae54af1bbf22c8bb91f 100644 (file)
@@ -396,5 +396,11 @@ void internal_unpack_8 (gfc_array_i8 *, const GFC_INTEGER_8 *);
 GFC_INTEGER_4 compare_string (GFC_INTEGER_4, const char *,
                              GFC_INTEGER_4, const char *);
 
+/* random.c */
+
+#define random_seed prefix(random_seed)
+void random_seed (GFC_INTEGER_4 * size, const gfc_array_i4 * put,
+             const gfc_array_i4 * get);
+
 #endif
 
index 60c032b4fcbbaaa2d817f03037d4abac33942bb9..e3eaf2b2ffcc3b5a02c78a41cc8ad4642ffb3a01 100644 (file)
@@ -100,6 +100,8 @@ init (void)
 #endif
 
   memory_init ();
+  random_seed(NULL,NULL,NULL);
+
 }