[PATCH] Implementation of RANDOM_INIT from F2018

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Jan 9 01:04:00 GMT 2018


On Sun, Jan 07, 2018 at 06:52:22PM -0800, Steve Kargl wrote:
> 
> 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.
> 

An epiphany came to me last night, which has led to the attach
patch.  This patch should be a complete implementation of
RANDOM_INIT.

RANDOM_INIT takes two LOGICAL, INTENT(IN) arguments.  To 
avoid library bloat, these arguments are converted/casted to
LOGICAL(4) in trans-intrinsic.c (conv_intrinsic_random_init).
It is also in this function, that I set up the hidden argument
that is needed to hopefully give standard conforming behavior
when co-arrays are involved.  I, however, cannot test -fcoarray=lib
situation.  I would appreciate feedback from a co-array user.

Boostrapped and regression tested on x86_64-*-freebsd.
OK to commit?

2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>

	* check.c (gfc_check_random_init): New function.  Check arguments of
	random_init().
	* gfortran.h (gfc_isym_id): Add GFC_ISYM_RANDOM_INIT.
	* intrinsic.c (add_subroutines): Make random_init() an intrinsic
	subroutine.
	(gfc_check_intrinsic_standard): Check for Fortran 2018.
	* intrinsic.h: Add prototypes for gfc_check_random_init and
	gfc_resolve_random_init.
	* iresolve.c (gfc_resolve_random_init): New function.  Add
	_gfortran_random_init to list of subroutines.
	* trans-decl.c: Describe gfor_fndecl_random_init.
	* trans-intrinsic.c (conv_intrinsic_random_init): New function.
	Translate random_init and added hidden argument.
	(gfc_conv_intrinsic_subroutine): Call conv_intrinsic_random_init.
	* trans.h: Declare gfor_fndecl_random_init.

2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>

	* gfortran.dg/random_init_1.f90: New test.
	* gfortran.dg/random_init_2.f90: New test.

2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>

	* gfortran.map: Add _gfortran_random_init to library map.
	* intrinsics/random.c (random_init): Implemenation of random_init.

-- 
steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random_init.diff
Type: text/x-diff
Size: 11135 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180109/003b2fc0/attachment.bin>


More information about the Gcc-patches mailing list