0e7e7e6e82
PR fortran/16580 PR fortran/29288 * gcc/fortran/intrinsic.c (add_sym): Define the actual_ok when a gfc_intrinsic_sym structure is filled. (gfc_intrinsic_actual_ok): New function. (add_sym_0s, add_sym_1s, add_sym_2s, add_sym_3s, add_sym_4s, add_sym_5s): Intrinsic subroutines are not allowed as actual arguments, so we remove argument actual_ok. (add_functions): Correct the values for actual_ok of all intrinsics. (add_subroutines): Remove the actual_ok argument, which was never used. * gcc/fortran/intrinsic.h (gfc_intrinsic_actual_ok): New prototype. * gcc/fortran/gfortran.h (gfc_resolve_index_func): New prototype. * gcc/fortran/resolve.c (resolve_actual_arglist): Check whether an intrinsic used as an argument list is allowed there. * gcc/fortran/iresolve.c (gfc_resolve_index_func): New function. (gfc_resolve_len): Change intrinsic function name to agree with libgfortran. * gcc/fortran/trans-decl.c (gfc_get_extern_function_decl): Add new case, because some specific intrinsics take 3 arguments. * gcc/fortran/intrinsic.texi: DIMAG is a GNU extension. * libgfortran/Makefile.am: Add the new files to the build process, and rules to build them. * libgfortran/Makefile.in: Regenerate. * libgfortran/m4/misc_specifics.m4: New file. * libgfortran/m4/specific.m4: Add new special cases for function with complex argument and real result, like abs_c* and aimag_c*. * libgfortran/intrinsics/f2c_specifics.F90: Add specifics for AIMAG, ASINH, ACOSH and ATANH. * libgfortran/generated/_aimag_c4.F90: New file. * libgfortran/generated/_aimag_c8.F90: New file. * libgfortran/generated/_asinh_r10.F90: New file. * libgfortran/generated/_acosh_r16.F90: New file. * libgfortran/generated/_aimag_c10.F90: New file. * libgfortran/generated/_atanh_r16.F90: New file. * libgfortran/generated/_acosh_r4.F90: New file. * libgfortran/generated/_acosh_r8.F90: New file. * libgfortran/generated/_asinh_r4.F90: New file. * libgfortran/generated/_asinh_r8.F90: New file. * libgfortran/generated/_asinh_r16.F90: New file. * libgfortran/generated/_atanh_r4.F90: New file. * libgfortran/generated/_atanh_r8.F90: New file. * libgfortran/generated/_acosh_r10.F90: New file. * libgfortran/generated/misc_specifics.F90: New file. * libgfortran/generated/_aimag_c16.F90: New file. * libgfortran/generated/_atanh_r10.F90: New file. * gcc/testsuite/gfortran.fortran-torture/execute/specifics.f90: Add tests for using all possible intrinsics as actual arguments. * gcc/testsuite/gfortran.dg/specifics_1.f90: Add tests for using all possible intrinsics as actual arguments. * gcc/testsuite/gfortran.dg/specifics_2.f90: New file. * gcc/testsuite/gfortran.dg/specifics_3.f90: New file. From-SVN: r117534
44 lines
2.1 KiB
Plaintext
44 lines
2.1 KiB
Plaintext
include(head.m4)
|
|
define(atype_code,regexp(file,`_\([ircl][0-9]+\).[fF]90',`\1'))dnl
|
|
define(atype_letter,substr(atype_code, 0, 1))dnl
|
|
define(atype_kind,substr(atype_code, 1))dnl
|
|
define(get_typename2, `$1 (kind=$2)')dnl
|
|
define(get_typename, `get_typename2(ifelse($1,i,integer,ifelse($1,r,real,ifelse($1,l,logical,ifelse($1,c,complex,unknown)))),`$2')')dnl
|
|
define(atype_name, get_typename(atype_letter,atype_kind))dnl
|
|
define(name, regexp(regexp(file, `[^/]*$', `\&'), `^_\([^_]*\)_', `\1'))dnl
|
|
define(rtype_name,get_typename(ifelse(name,abs,ifelse(atype_letter,c,r,atype_letter),ifelse(name,aimag,ifelse(atype_letter,c,r,atype_letter),atype_letter)),atype_kind))dnl
|
|
define(function_name,ifelse(name,conjg,`specific__conjg_'atype_kind,`specific__'name`_'atype_code))dnl
|
|
|
|
define(type,ifelse(atype_letter,l,LOGICAL,ifelse(atype_letter,i,INTEGER,ifelse(atype_letter,r,REAL,ifelse(atype_letter,c,COMPLEX,UNKNOW)))))dnl
|
|
define(Q,ifelse(atype_kind,4,F,ifelse(atype_kind,8,`',ifelse(atype_kind,10,L,ifelse(atype_kind,16,L,`_'atype_kind)))))dnl
|
|
|
|
dnl A few specifics require a function other than their name, or
|
|
dnl nothing. The list is currently:
|
|
dnl - integer and logical specifics require no libm function
|
|
dnl - AINT requires the trunc() family functions
|
|
dnl - ANINT requires round()
|
|
dnl - AIMAG, CONJG, DIM, SIGN require no libm function
|
|
define(needed,ifelse(atype_letter,i,`none',ifelse(atype_letter,l,`none',ifelse(name,aint,trunc,ifelse(name,anint,round,ifelse(name,aimag,none,ifelse(name,conjg,none,ifelse(name,dim,none,ifelse(name,sign,none,ifelse(name,abs,fabs,name))))))))))dnl
|
|
define(prefix,ifelse(atype_letter,c,C,`'))dnl
|
|
|
|
dnl Special case for fabs, for which the corresponding complex function
|
|
dnl is not cfabs but cabs.
|
|
define(NEEDED,translit(ifelse(prefix`'needed,`Cfabs',`abs',needed),`a-z',`A-Z'))dnl
|
|
|
|
#include "config.h"
|
|
#include "kinds.inc"
|
|
#include "c99_protos.inc"
|
|
|
|
`#if defined (HAVE_GFC_'type`_'atype_kind`)'
|
|
ifelse(NEEDED,NONE,`',`#ifdef HAVE_'prefix`'NEEDED`'Q)
|
|
|
|
elemental function function_name (parm)
|
|
atype_name, intent (in) :: parm
|
|
rtype_name :: function_name
|
|
|
|
function_name = name (parm)
|
|
end function
|
|
|
|
ifelse(NEEDED,NONE,`',`#endif')
|
|
#endif
|