public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114146] New: REPEATABLE argument of RANDOM_INIT and repeated execution of the program
@ 2024-02-28  9:23 wxcvbn789456123-nw6wda at yahoo dot com
  2024-02-28 16:05 ` [Bug fortran/114146] " kargl at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: wxcvbn789456123-nw6wda at yahoo dot com @ 2024-02-28  9:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114146

            Bug ID: 114146
           Summary: REPEATABLE argument of RANDOM_INIT and repeated
                    execution of the program
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wxcvbn789456123-nw6wda at yahoo dot com
  Target Milestone: ---

Reading the documentation for the random_init subroutine at this address:

https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gfortran/RANDOM_005fINIT.html

This documentation states the following when this subroutine is called with an
argument REPEATABLE set to .TRUE. :

"If it [REPEATABLE] is .true., the seed is set to a processor-dependent value
that is the same each time RANDOM_INIT is called from the same image. The term
“same image” means a single instance of program execution. The sequence of
random numbers is different for repeated execution of the program."

(The same text appears in version 11.4.0 of the documentation).

However, in the example below, repeated executions of the program "a.exe"
generate the same sequence of random numbers.

bash 1 : uname -smo
CYGWIN_NT-10.0-19045 x86_64 Cygwin
bash 2 : gfortran --version | head -2
GNU Fortran (GCC) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
bash 3 : cat a.f90

PROGRAM random_init_test
   REAL :: x(2)
   CALL random_init(REPEATABLE=.TRUE., IMAGE_DISTINCT=.TRUE.)
   CALL random_number(x)
   PRINT *, x
END PROGRAM random_init_test

bash 4 : gfortran a.f90 -o a.exe
bash 5 : ./a.exe
  0.825262189      0.191325366
bash 6 : ./a.exe
  0.825262189      0.191325366
bash 7 : sleep 10
bash 8 : ./a.exe
  0.825262189      0.191325366

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/114146] REPEATABLE argument of RANDOM_INIT and repeated execution of the program
  2024-02-28  9:23 [Bug fortran/114146] New: REPEATABLE argument of RANDOM_INIT and repeated execution of the program wxcvbn789456123-nw6wda at yahoo dot com
@ 2024-02-28 16:05 ` kargl at gcc dot gnu.org
  2024-08-15 20:39 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2024-02-28 16:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114146

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
   Last reconfirmed|                            |2024-02-28
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |minor
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
gfortran's implementation matches the wording of the Fortran 2023 standard.

   Case (i):  CALL RANDOM_INIT (REPEATABLE=true, IMAGE_DISTINCT=true) is
equivalent
      to invoking RANDOM_SEED with a processor-dependent value for PUT that is
      different on every invoking image. In each execution of the program with
the
      same execution environment, if the invoking image index value in the
initial
      team is the same, the value for PUT shall be the same.

Looks like someone needs to update the gfortran manual.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/114146] REPEATABLE argument of RANDOM_INIT and repeated execution of the program
  2024-02-28  9:23 [Bug fortran/114146] New: REPEATABLE argument of RANDOM_INIT and repeated execution of the program wxcvbn789456123-nw6wda at yahoo dot com
  2024-02-28 16:05 ` [Bug fortran/114146] " kargl at gcc dot gnu.org
@ 2024-08-15 20:39 ` anlauf at gcc dot gnu.org
  2024-08-16 16:30 ` cvs-commit at gcc dot gnu.org
  2024-08-17  8:30 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-08-15 20:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114146

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to kargls from comment #1)
> Looks like someone needs to update the gfortran manual.

Submitted: https://gcc.gnu.org/pipermail/fortran/2024-August/060848.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/114146] REPEATABLE argument of RANDOM_INIT and repeated execution of the program
  2024-02-28  9:23 [Bug fortran/114146] New: REPEATABLE argument of RANDOM_INIT and repeated execution of the program wxcvbn789456123-nw6wda at yahoo dot com
  2024-02-28 16:05 ` [Bug fortran/114146] " kargl at gcc dot gnu.org
  2024-08-15 20:39 ` anlauf at gcc dot gnu.org
@ 2024-08-16 16:30 ` cvs-commit at gcc dot gnu.org
  2024-08-17  8:30 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-08-16 16:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114146

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:07ece73d4712c68144a07681b24a8c1f963256ab

commit r15-2955-g07ece73d4712c68144a07681b24a8c1f963256ab
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Aug 15 22:31:11 2024 +0200

    Fortran: fix documentation of intrinsic RANDOM_INIT [PR114146]

    gcc/fortran/ChangeLog:

            PR fortran/114146
            * intrinsic.texi: Fix documentation of arguments of RANDOM_INIT,
            which is conforming to the F2018 standard.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/114146] REPEATABLE argument of RANDOM_INIT and repeated execution of the program
  2024-02-28  9:23 [Bug fortran/114146] New: REPEATABLE argument of RANDOM_INIT and repeated execution of the program wxcvbn789456123-nw6wda at yahoo dot com
                   ` (2 preceding siblings ...)
  2024-08-16 16:30 ` cvs-commit at gcc dot gnu.org
@ 2024-08-17  8:30 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-08-17  8:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114146

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from anlauf at gcc dot gnu.org ---
The updated docomentation is visible at

https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fINIT.html

Thus fixed.

Thanks for the report!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-17  8:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28  9:23 [Bug fortran/114146] New: REPEATABLE argument of RANDOM_INIT and repeated execution of the program wxcvbn789456123-nw6wda at yahoo dot com
2024-02-28 16:05 ` [Bug fortran/114146] " kargl at gcc dot gnu.org
2024-08-15 20:39 ` anlauf at gcc dot gnu.org
2024-08-16 16:30 ` cvs-commit at gcc dot gnu.org
2024-08-17  8:30 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).