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