diff options
author | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2006-10-07 13:34:16 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2006-10-07 13:34:16 +0000 |
commit | 0e7e7e6e82451de69f2449372e91df1f55888be8 (patch) | |
tree | 7d388fa3ec358e48da0a798ae99b8b3ed8f52f37 /libgfortran/m4 | |
parent | 73d1943acd41e5ee89a530d31aef4559a9cd76ed (diff) | |
download | gcc-0e7e7e6e82451de69f2449372e91df1f55888be8.zip gcc-0e7e7e6e82451de69f2449372e91df1f55888be8.tar.gz gcc-0e7e7e6e82451de69f2449372e91df1f55888be8.tar.bz2 |
re PR fortran/16580 ([4.1 only] gfortran ICE on test g77.f-torture/execute/intrinsic77.f)
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
Diffstat (limited to 'libgfortran/m4')
-rw-r--r-- | libgfortran/m4/misc_specifics.m4 | 64 | ||||
-rw-r--r-- | libgfortran/m4/specific.m4 | 6 |
2 files changed, 67 insertions, 3 deletions
diff --git a/libgfortran/m4/misc_specifics.m4 b/libgfortran/m4/misc_specifics.m4 new file mode 100644 index 0000000..dff63d8 --- /dev/null +++ b/libgfortran/m4/misc_specifics.m4 @@ -0,0 +1,64 @@ +include(head.m4)dnl +dnl +dnl This file contains the specific functions that are not handled in the +dnl m4/specific.m4 file. + +#include "config.h" +#include "kinds.inc" + +dnl This is from GNU m4 examples file foreach.m4: +divert(-1) +# foreach(x, (item_1, item_2, ..., item_n), stmt) +define(`foreach', `pushdef(`$1', `')_foreach(`$1', `$2', +`$3')popdef(`$1')') +define(`_arg1', `$1') +define(`_foreach', + `ifelse(`$2', `()', , + `define(`$1', _arg1$2)$3`'_foreach(`$1', (shift$2), +`$3')')') +# traceon(`define', `foreach', `_foreach', `ifelse') +divert + +dnl NINT specifics +foreach(`ikind', `(4, 8, 16)', `foreach(`rkind', `(4, 8, 10, 16)', ` +`#if defined (HAVE_GFC_REAL_'rkind`) && defined (HAVE_GFC_INTEGER_'ikind`)' +elemental function specific__nint_`'ikind`_'rkind (parm) + real (kind=rkind) , intent (in) :: parm + integer (kind=ikind) :: specific__nint_`'ikind`_'rkind + specific__nint_`'ikind`_'rkind = nint (parm) +end function +#endif +')') + +dnl CHAR specifics +foreach(`ckind', `(1)', `foreach(`ikind', `(4, 8, 16)', ` +`#if defined (HAVE_GFC_INTEGER_'ikind`)' +elemental function specific__char_`'ckind`_i'ikind (parm) + integer (kind=ikind) , intent (in) :: parm + character (kind=ckind,len=1) :: specific__char_`'ckind`_i'ikind + specific__char_`'ckind`_i'ikind` = char (parm, kind='ckind`)' +end function +#endif +')') + +dnl LEN specifics +foreach(`ckind', `(1)', `foreach(`ikind', `(4, 8, 16)', ` +`#if defined (HAVE_GFC_INTEGER_'ikind`)' +elemental function specific__len_`'ckind`_i'ikind (parm) + character (kind=ckind,len=*) , intent (in) :: parm + integer (kind=ikind) :: specific__len_`'ckind`_i'ikind + specific__len_`'ckind`_i'ikind` = len (parm)' +end function +#endif +')') + +dnl INDEX specifics +foreach(`ckind', `(1)', `foreach(`ikind', `(4, 8, 16)', ` +`#if defined (HAVE_GFC_INTEGER_'ikind`)' +elemental function specific__index_`'ckind`_i'ikind (parm1, parm2) + character (kind=ckind,len=*) , intent (in) :: parm1, parm2 + integer (kind=ikind) :: specific__index_`'ckind`_i'ikind + specific__index_`'ckind`_i'ikind` = index (parm1, parm2)' +end function +#endif +')') diff --git a/libgfortran/m4/specific.m4 b/libgfortran/m4/specific.m4 index a0d03dc..c8c9152 100644 --- a/libgfortran/m4/specific.m4 +++ b/libgfortran/m4/specific.m4 @@ -6,7 +6,7 @@ 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),atype_letter),atype_kind))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 @@ -17,8 +17,8 @@ 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 - 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,conjg,none,ifelse(name,dim,none,ifelse(name,sign,none,ifelse(name,abs,fabs,name)))))))))dnl +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 |