diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2021-05-22 13:27:42 +0200 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2021-05-22 13:27:42 +0200 |
commit | 26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c (patch) | |
tree | 992eca69f9e2e4007a4c324df7aca1893a3f488a /gcc/fortran/trans-decl.c | |
parent | 3050a1a18276d7cdd8946e34cc1344e30efb7030 (diff) | |
download | gcc-26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c.zip gcc-26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c.tar.gz gcc-26ca6dbda23bc6dfab96ce07afa70ebacedfaf9c.tar.bz2 |
Steve Kargl <kargl@gcc.gnu.org>
PR fortran/98301 - random_init() is broken
Correct implementation of random_init() when -fcoarray=lib is given.
gcc/fortran/ChangeLog:
PR fortran/98301
* trans-decl.c (gfc_build_builtin_function_decls): Move decl.
* trans-intrinsic.c (conv_intrinsic_random_init): Use bool for
lib-call of caf_random_init instead of logical (4-byte).
* trans.h: Add tree var for random_init.
libgfortran/ChangeLog:
PR fortran/98301
* caf/libcaf.h (_gfortran_caf_random_init): New function.
* caf/single.c (_gfortran_caf_random_init): New function.
* gfortran.map: Added fndecl.
* intrinsics/random_init.f90: Implement random_init.
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 406b4ae..c32bd05 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -170,6 +170,7 @@ tree gfor_fndecl_co_min; tree gfor_fndecl_co_reduce; tree gfor_fndecl_co_sum; tree gfor_fndecl_caf_is_present; +tree gfor_fndecl_caf_random_init; /* Math functions. Many other math functions are handled in @@ -233,7 +234,7 @@ tree gfor_fndecl_cgemm; tree gfor_fndecl_zgemm; /* RANDOM_INIT function. */ -tree gfor_fndecl_random_init; +tree gfor_fndecl_random_init; /* libgfortran, 1 image only. */ static void gfc_add_decl_to_parent_function (tree decl) @@ -3516,6 +3517,8 @@ gfc_build_intrinsic_function_decls (void) void_type_node, 3, gfc_logical4_type_node, gfc_logical4_type_node, gfc_int4_type_node); + // gfor_fndecl_caf_rand_init is defined in the lib-coarray section below. + gfor_fndecl_sc_kind = gfc_build_library_function_decl_with_spec ( get_identifier (PREFIX("selected_char_kind")), ". . R ", gfc_int4_type_node, 2, gfc_charlen_type_node, pchar_type_node); @@ -4081,6 +4084,10 @@ gfc_build_builtin_function_decls (void) get_identifier (PREFIX("caf_is_present")), ". r . r ", integer_type_node, 3, pvoid_type_node, integer_type_node, pvoid_type_node); + + gfor_fndecl_caf_random_init = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_random_init")), + void_type_node, 2, logical_type_node, logical_type_node); } gfc_build_intrinsic_function_decls (); |