diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2025-03-21 16:20:21 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2025-03-21 16:20:21 +0000 |
commit | 94fa9f4d27bac577ecab43379a31fa28b146d6d9 (patch) | |
tree | 2e7ceb188705afbc476c1fbbe33c8f5f6a2da781 /gcc/c | |
parent | 1d2257dc850d088f6d9267b4624ba08533ab2475 (diff) | |
download | gcc-94fa9f4d27bac577ecab43379a31fa28b146d6d9.zip gcc-94fa9f4d27bac577ecab43379a31fa28b146d6d9.tar.gz gcc-94fa9f4d27bac577ecab43379a31fa28b146d6d9.tar.bz2 |
Fortran: Implement the F2018 reduce intrinsic [PR85836]
2025-03-21 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/85836
* check.cc (get_ul_from_cst_cl): New function used in
check_operation.
(check_operation): New function used in check_reduce and
check_co_reduce.
(gfc_check_co_reduce): Use it.
(gfc_check_reduce): New function.
(gfc_check_rename): Add prototype for intrinsic with 6 arguments.
* gfortran.h : Add isym id for reduce and prototype for f6.
* intrinsic.cc (do_check): Add another argument expression and use
it in the call to the six argument specific check.
(add_sym_6): New function.
(add_functions): Add the discription of the reduce intrinsic and
add it to the intrinsic list.
* intrinsic.h : Add prototypes for gfc_check_reduce and
gfc_resolve_reduce.
* iresolve.cc (generate_reduce_op_wrapper): Generate a wrapper
subroutine for the 'operation' function to enable the library
implementation to be type agnostic and use pointer arithmetic
throughout.
(gfc_resolve_reduce): New function.
* trans-expr.cc (gfc_conv_procedure_call): Add flag for scalar
reduce. Generate a return variable 'sr' for scalar reduce, pass its
address to the library function and return it as the scalar result.
* trans-intrinsic.cc (gfc_conv_intrinsic_function): Array valued
reduce is called in same way as reshape. Fall through for call to
the scalar version.
gcc/testsuite/
PR fortran/85836
* gfortran.dg/reduce_1.f90: New test
* gfortran.dg/reduce_2.f90: New test
libgfortran/
PR libfortran/85836
* Makefile.am : Add reduce.c
* Makefile.in : Regenerated
* gfortran.map : Add _gfortran_reduce, _gfortran_reduce_scalar,
_gfortran_reduce_c and _gfortran_reduce_scalar_c to the list.
* intrinsics/reduce.c (reduce, reduce_scalar, reduce_c,
reduce_scalar_c): New functions and prototypes
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions