[PATCH] Implementation of RANDOM_INIT from F2018
Steve Kargl
sgk@troutmask.apl.washington.edu
Mon Jan 8 02:51:00 GMT 2018
I have attached my current implementation for RANDOM_INIT.
For programs compiled without -fcoarry= or with -fcoarray=single,
the one gets,
% cat random_init_2.f90
program foo
real x(2)
call random_init(.false., .false.)
call random_number(x)
print *, x
call random_init(.false., .false.)
call random_number(x)
print *, x
call random_init(.true., .false.)
call random_number(x)
print *, x
call random_init(.true., .false.)
call random_number(x)
print *, x
end program foo
% gfcx -o z random_init_2.f90 && ./z
0.817726076 0.318128884
0.598739505 2.99510360E-02
0.336736381 0.870776474
0.336736381 0.870776474
Now, with -fcoarray=lib, one gets
% gfcx -fcoarray=lib -c random_init_2.f90
f951: Fatal Error: RANDOM_INIT with co-arrays is broken!
compilation terminated.
I have zero knowledge about co-arrays and especially zero
knowledge about gfortran internals for co-arrays. I'm
disinclined to waste another 12 hours trying to get gfortran
to emit essentially a call to this_image(). See iresolve.c
for details.
2018-01-07 Steven G. Kargl <kargl@gcc.gnu.org>
* check.c (gfc_check_random_init): New function.
* gfortran.h: Define GFC_ISYM_RANDOM_INIT.
* intrinsic.c (add_subroutines): Add random_init to list of subroutines.
(gfc_check_intrinsic_standard): Update error message for Fortran 2018.
* intrinsic.h: Add prototypes for gfc_check_random_init and
gfc_resolve_random_init.
* iresolve.c (gfc_resolve_random_init): Implementation.
2018-01-07 Steven G. Kargl <kargl@gcc.gnu.org>
* libgfortran/gfortran.map: Add _gfortran_random_init.
* libgfortran/intrinsics/random.c: Add implemention of
_gfortran_random_init
--
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.diff
Type: text/x-diff
Size: 9389 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180108/5507f28b/attachment.bin>
More information about the Gcc-patches
mailing list