[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #10 from dennis dot wassel at googlemail dot com 2008-11-10 13:32 --- Subject: Re: RANDOM_SEED: PUT= check array size at compile time The documentation says only that the size argument has to be an integer. See http://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fSEED.html On the contrary: The documentation clearly and concisely states SIZE(Optional) Shall be a scalar and of type default INTEGER, with INTENT(OUT). It specifies the minimum size of the arrays used with the PUT and GET arguments. Admitted, it does not say SIZE = 8, because this value may be compiler- and system-dependent (may also be 12 for gfortran on some platforms), which is why the standard provides the SIZE argument in the first place. I fail to see the problem - could you clarify? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #9 from michael dot a dot richmond at nasa dot gov 2008-11-10 12:59 --- (In reply to comment #8) If you check, the minimum size of count is 8 as returned by the size= argument if you use it. Try this. size is intent OUT. The documentation says only that the size argument has to be an integer. See http://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fSEED.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #11 from michael dot a dot richmond at nasa dot gov 2008-11-10 13:50 --- (In reply to comment #10) Admitted, it does not say SIZE = 8, because this value may be compiler- and system-dependent (may also be 12 for gfortran on some platforms), which is why the standard provides the SIZE argument in the first place. I fail to see the problem - could you clarify? A default integer on i386 is 4 bytes. The instruction print sizeof(size) prints 4. I assume it should also print 4 if I use: CALL Random_Seed(size=size) print *, size -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #12 from kargl at gcc dot gnu dot org 2008-11-10 15:01 --- (In reply to comment #11) (In reply to comment #10) Admitted, it does not say SIZE = 8, because this value may be compiler- and system-dependent (may also be 12 for gfortran on some platforms), which is why the standard provides the SIZE argument in the first place. I fail to see the problem - could you clarify? A default integer on i386 is 4 bytes. The instruction print sizeof(size) prints 4. I assume it should also print 4 if I use: CALL Random_Seed(size=size) print *, size 'SIZE' is the number of elements in the array that you need to use with PUT= and GET= program a integer, allocatable :: seeds(:) integer n call random_seed(size = n) allocate(seeds(n)) call random_seed(get = seeds) print*, seeds deallocate(seeds) end program It seems you need to revisit Metcalf and Reid or the Standard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #7 from michael dot a dot richmond at nasa dot gov 2008-11-10 00:09 --- I get a compile-time error: [EMAIL PROTECTED]:~$ cat sort1.f90 PROGRAM sort1 INTEGER Count(1) !Current value of system clock CALL Random_Seed(Put=Count) END PROGRAM sort1 [EMAIL PROTECTED]:~$ gfortran sort1.f90 sort1.f90:3.23: CALL Random_Seed(Put=Count) 1 Error: Array PUT of intrinsic random_seed is too small (1/8) at (1) -- michael dot a dot richmond at nasa dot gov changed: What|Removed |Added CC||michael dot a dot richmond ||at nasa dot gov http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #8 from jvdelisle at gcc dot gnu dot org 2008-11-10 03:16 --- If you check, the minimum size of count is 8 as returned by the size= argument if you use it. Try this. size is intent OUT. PROGRAM sort1 INTEGER Count(1) !Current value of system clock integer Size CALL Random_Seed(size=size) print *, size ! CALL Random_Seed(Put=Count) END PROGRAM sort1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #6 from burnus at gcc dot gnu dot org 2008-11-02 14:18 --- Not closing yet, as the GET array could also be checked, see http://gcc.gnu.org/ml/fortran/2008-10/msg00281.html . Another item: If the default integer is 8 instead of 4, the array sizes are half as big (see also URL). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #4 from tkoenig at gcc dot gnu dot org 2008-11-01 10:25 --- Subject: Bug 37159 Author: tkoenig Date: Sat Nov 1 10:24:15 2008 New Revision: 141511 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=141511 Log: 2008-11-01 Dennis Wassel [EMAIL PROTECTED] PR fortran/37159 * fortran/check.c (gfc_check_random_seed): Check PUT size at compile time. 2008-11-01 Dennis Wassel [EMAIL PROTECTED] PR fortran/37159 * intrinsics/random.c: Added comment to adapt check.c, should kiss_size change. Few cosmetic changes to existing comments. 2008-11-01 Dennis Wassel [EMAIL PROTECTED] PR fortran/37159 * gfortran.dg/random_seed_1.f90: New testcase. Added: trunk/gcc/testsuite/gfortran.dg/random_seed_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/check.c trunk/gcc/testsuite/ChangeLog trunk/libgfortran/ChangeLog trunk/libgfortran/intrinsics/random.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #5 from tkoenig at gcc dot gnu dot org 2008-11-01 10:29 --- Committed patch. Not closing yet, as the GET array could also be checked, see http://gcc.gnu.org/ml/fortran/2008-10/msg00281.html . Thomas -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #3 from dennis dot wassel at googlemail dot com 2008-09-18 21:00 --- Updated patch: http://gcc.gnu.org/ml/fortran/2008-09/msg00161.html Will be committed by Thomas Koenig as soon as my copyright assignment is done. How come I cannot add myself in the assigned to or change the status? -- dennis dot wassel at googlemail dot com changed: What|Removed |Added CC||dennis dot wassel at ||googlemail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #1 from burnus at gcc dot gnu dot org 2008-08-24 06:36 --- Patch: http://gcc.gnu.org/ml/fortran/2008-08/msg00190.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159
[Bug fortran/37159] RANDOM_SEED: PUT= check array size at compile time
--- Comment #2 from tkoenig at gcc dot gnu dot org 2008-08-24 18:34 --- Confirmed. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-08-24 18:34:07 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37159