Hi Steve,

I hope the gfortran developers won't commit a patch that replaces
existing behavior with a stub that simply emits an error message.  It
has been a while since I looked at the previous emails regarding
problems with the current behavior so I'm not expressing an opinion
about the current behavior.  I'm simply advocating against breaking
existing codes that rely on the current behavior if nothing better is
being provided.

Or as a compromise, would you mind changing the patch so that the
error message is emitted only in the problematic cases? You presented
one problematic case out of the four possible combinations of
RANDOM_INIT() arguments.  With only four possible combinations to
enumerate, I hope this suggestion isn't burdensome.

Regarding "someone who cares about coarray Fortran," finding people to
work on such an effort is quite challenging.  I believe Andre
Verheschild has some limited availability so I'm cc'ing him and will
discuss it with him if he's interested.  If you know others who might
be interested, please let us know.

Damian

On Sat, Apr 3, 2021 at 10:28 AM Steve Kargl via Fortran
<fortran@gcc.gnu.org> wrote:
>
> What to do about RANDOM_INIT() and coarray Fortran?
>
> The main issue is that if one compiles with -fcoarray=lib
> (or the WIP -fcoarray=shared), then RANDOM_INIT() may
> require communication between images.  Thus, RANDOM_INIT()
> cannot live in libgfortran for at least -fcoarray=lib.
>
> Consider the simple code:
>
> subroutine foo
>    call random_init(.true., .false.)
> end subroutine foo
>
> I have updated the patch for
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98301
> to use a stub routine for -fcoarray=lib and -fcoarray=shared.
> Anyone, who knows how to use git, is encouraged to commit the patch.
>
> For -fcoarray=none (default option) and -fcoarray=single, the
> patch will cause gfortran to generate
>
> __attribute__((fn spec (". ")))
> void foo ()
> {
>   _gfortran_random_init (1, 0, 0);
> }
>
> _gfortran_random_init() live in libgfortran and it has been updated
> to meet the intended requires of the Fortran standard.
>
> With -fcoarray=lib and -fcoarray=shared, gfortran will now generate
>
> __attribute__((fn spec (". ")))
> void foo ()
> {
>   _gfortran_random_init_foobar (1, 0);
> }
>
> where _gfortran_random_init_foobar() lives in libgfortran.  It prints
> an error message that RANDOM_INIT() is not yet supported for coarray
> Fortran and exits.  Someone, who cares about coarray Fortran, can fix
> -fcoarray=lib and -fcoarray=shared by updating trans-decl.c (see the
> FIXME for random_init()) to emit
>
> __attribute__((fn spec (". ")))
> void foo ()
> {
>   _gfortran_caf_random_init (1, 0);
> }
>
> or
>
> __attribute__((fn spec (". ")))
> void foo ()
> {
>   _gfortran_cas_random_init (1, 0);
> }
>
> --
> Steve

Reply via email to