gcc/libgfortran
Paul Thomas 94fa9f4d27 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
2025-03-21 16:20:21 +00:00
..
caf Fortran: Fix build on solaris [PR107635] 2025-02-21 09:13:50 +01:00
config nvptx: Build libgfortran with '-mfake-ptx-alloca' [PR107635] 2025-02-27 21:48:15 +01:00
generated Add modular exponentiation for UNSIGNED. 2025-02-04 08:56:19 +01:00
ieee Update copyright years. 2025-01-02 11:59:57 +01:00
intrinsics Fortran: Implement the F2018 reduce intrinsic [PR85836] 2025-03-21 16:20:21 +00:00
io Fortran: Fix handling of the X edit descriptor. 2025-02-06 09:43:26 -08:00
m4 Add modular exponentiation for UNSIGNED. 2025-02-04 08:56:19 +01:00
runtime libfortran: fix conversion of UNSIGNED(kind=16) to decimal in output [PR118406] 2025-01-16 20:43:16 +01:00
acinclude.m4
aclocal.m4
c99_protos.h Update copyright years. 2025-01-02 11:59:57 +01:00
ChangeLog Daily bump. 2025-02-28 00:16:37 +00:00
ChangeLog-2002 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2003 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2004 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2005 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2006 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2007 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2008 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2009 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2010 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2011 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020
ChangeLog-2021
ChangeLog-2022 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2023 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
ChangeLog-2024 Rotate ChangeLog files. 2025-01-02 11:06:31 +01:00
config.h.in
configure nvptx, libgfortran: Switch out of "minimal" mode 2024-06-06 13:41:47 +02:00
configure.ac nvptx, libgfortran: Switch out of "minimal" mode 2024-06-06 13:41:47 +02:00
configure.host nvptx: Build libgfortran with '-mfake-ptx-alloca' [PR107635] 2025-02-27 21:48:15 +01:00
gfortran.map Fortran: Implement the F2018 reduce intrinsic [PR85836] 2025-03-21 16:20:21 +00:00
ISO_Fortran_binding.h Update copyright years. 2025-01-02 11:59:57 +01:00
kinds-override.h Update copyright years. 2025-01-02 11:59:57 +01:00
libgfortran.h Update copyright years. 2025-01-02 11:59:57 +01:00
libgfortran.spec.in libgfortran: avoid duplicate libraries in spec 2023-12-19 22:10:55 +01:00
libtool-version
Makefile.am Fortran: Implement the F2018 reduce intrinsic [PR85836] 2025-03-21 16:20:21 +00:00
Makefile.in Fortran: Implement the F2018 reduce intrinsic [PR85836] 2025-03-21 16:20:21 +00:00
mk-kinds-h.sh Implement first part of unsigned integers for Fortran. 2024-09-07 17:12:17 +02:00
mk-sik-inc.sh
mk-srk-inc.sh