summaryrefslogtreecommitdiff
path: root/gcc/fortran/intrinsic.c
diff options
context:
space:
mode:
authorpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-29 15:58:16 +0000
committerpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-29 15:58:16 +0000
commit158e0e64456930a3a1d439043a9c27d6a8057d2d (patch)
tree764a8802dba0b681b9c0d6f4248a2b2513c2b2fc /gcc/fortran/intrinsic.c
parent7b4fe863dd609e49323d9b07781a0b09d75ad9e5 (diff)
downloadgcc-158e0e64456930a3a1d439043a9c27d6a8057d2d.tar.gz
2004-08-29 Steven G. Kargl <kargls@comcast.net>
Paul Brook <paul@codesourcery.com> * check.c (gfc_check_besn, gfc_check_g77_math1): New functions. * f95-lang.c (DO_DEFINE_MATH_BUILTIN): Define. (DEFINE_MATH_BUILTIN, DEFINE_MATH_BUILTIN_C): Use it. (build_builtin_fntypes): New function. (gfc_init_builtin_functions): Use it. * gfortran.h (enum gfc_generic_isym_id): Add GFC_ISYM_{J,Y}{0,1,N} and GFC_ISYM_ERF{,C}. (gfc_c_int_kind): Declare. * intrinsic.c (add_functions): Add [d]bes* and [d]erf*. * intrinsic.h (gfc_check_besn, gfc_check_g77_math1, gfc_resolve_besn, gfc_resolve_g77_math1): Add prototypes. * resolve.c (gfc_resolve_besn, gfc_resolve_g77_math1): New functions. * mathbuiltins.def: Add comment. Change third argument. Use DEFINE_MATH_BUILTIN_C. Add bessel and error functions. * trans-intrinsic.c (BUILT_IN_FUNCTION): Define. (DEFINE_MATH_BUILTIN, DEFINE_MATH_BUILTIN_C): Use it. * trans-types.c (gfc_c_int_kind): Declare. (gfc_init_kinds): Set it. testsuite/ * gfortran.dg/g77/README: Update. * gfortran.dg/g77/erfc.f: Copy from g77.f-torture. * gfortran.dg/g77/intrinsic-unix-bessel.f: Ditto. * gfortran.dg/g77/intrinsic-unix-erf.f: Ditto. libgfortran/ * intrinsics/bessel.c: New file. * intrinsics/erf.c: New file. * Makefie.am: Add intrinsics/bessel.c and intrinsics/erf.c. * configure.ac: Test for C99 Bessel and Error functions. * Makefile.in: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/intrinsic.c')
-rw-r--r--gcc/fortran/intrinsic.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 4e680907f78..414cc1a5913 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -969,6 +969,68 @@ add_functions (void)
make_generic ("atan2", GFC_ISYM_ATAN2);
+ /* Bessel and Neumann functions for G77 compatibility. */
+
+ add_sym_1 ("besj0", 1, 0, BT_REAL, dr,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dr, 0);
+
+ add_sym_1 ("dbesj0", 1, 0, BT_REAL, dd,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dd, 0);
+
+ make_generic ("besj0", GFC_ISYM_J0);
+
+ add_sym_1 ("besj1", 1, 0, BT_REAL, dr,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dr, 1);
+
+ add_sym_1 ("dbesj1", 1, 0, BT_REAL, dd,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dd, 1);
+
+ make_generic ("besj1", GFC_ISYM_J1);
+
+ add_sym_2 ("besjn", 1, 0, BT_REAL, dr,
+ gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+ x, BT_REAL, dr, 1);
+
+ add_sym_2 ("dbesjn", 1, 0, BT_REAL, dd,
+ gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+ x, BT_REAL, dd, 1);
+
+ make_generic ("besjn", GFC_ISYM_JN);
+
+ add_sym_1 ("besy0", 1, 0, BT_REAL, dr,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dr, 0);
+
+ add_sym_1 ("dbesy0", 1, 0, BT_REAL, dd,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dd, 0);
+
+ make_generic ("besy0", GFC_ISYM_Y0);
+
+ add_sym_1 ("besy1", 1, 0, BT_REAL, dr,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dr, 1);
+
+ add_sym_1 ("dbesy1", 1, 0, BT_REAL, dd,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dd, 1);
+
+ make_generic ("besy1", GFC_ISYM_Y1);
+
+ add_sym_2 ("besyn", 1, 0, BT_REAL, dr,
+ gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+ x, BT_REAL, dr, 1);
+
+ add_sym_2 ("dbesyn", 1, 0, BT_REAL, dd,
+ gfc_check_besn, NULL, gfc_resolve_besn, n, BT_INTEGER, di, 1,
+ x, BT_REAL, dd, 1);
+
+ make_generic ("besyn", GFC_ISYM_YN);
+
add_sym_1 ("bit_size", 0, 1, BT_INTEGER, di,
gfc_check_i, gfc_simplify_bit_size, NULL,
i, BT_INTEGER, di, 0);
@@ -1113,6 +1175,27 @@ add_functions (void)
make_generic ("epsilon", GFC_ISYM_NONE);
+ /* G77 compatibility for the ERF() and ERFC() functions. */
+ add_sym_1 ("erf", 1, 0, BT_REAL, dr,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dr, 0);
+
+ add_sym_1 ("derf", 1, 0, BT_REAL, dd,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dd, 0);
+
+ make_generic ("erf", GFC_ISYM_ERF);
+
+ add_sym_1 ("erfc", 1, 0, BT_REAL, dr,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dr, 0);
+
+ add_sym_1 ("derfc", 1, 0, BT_REAL, dd,
+ gfc_check_g77_math1, NULL, gfc_resolve_g77_math1,
+ x, BT_REAL, dd, 0);
+
+ make_generic ("erfc", GFC_ISYM_ERFC);
+
/* G77 compatibility */
add_sym_1 ("etime", 0, 1, BT_REAL, 4,
gfc_check_etime, NULL, NULL,