This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix some more decl types in the Fortran frontend
- From: Bernd Schmidt <bernds at codesourcery dot com>
- To: FX <fxcoudert at gmail dot com>, Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Tobias Burnus <burnus at net-b dot de>
- Date: Thu, 11 Sep 2014 18:30:39 +0200
- Subject: Re: Fix some more decl types in the Fortran frontend
- Authentication-results: sourceware.org; auth=none
- References: <6E27F243-5363-4702-A606-5B26E9C5CE15 at gmail dot com>
On 09/11/2014 12:37 PM, FX wrote:
Changing the fntype[2] looks wrong to me, as it is also used for
powi(double, int) , where the argument order matches the current
version:
Ah, sorry. I only looked at mathbuiltins.def and didn't spot the other use.
It looks like fntype[5] is actually what you need, and it’s already
constructed! However, there is even more mistery here, because it is
currently used for __builtin_scalbn, which doesn’t seem right:
http://pubs.opengroup.org/onlinepubs/009695399/functions/scalbln.html
So I suspect looking a bit more in depth is required! Also,
testcases that excercise this fndecl matching (which you would see
fail on ptx) would be a great addition to the testsuite, once you
commit (for powi & scalbn, which do not look covered right now,
otherwise you would have seen regressions).
So it looks like the following patch would be the right thing? I'm
afraid I failed to construct a compileable Fortran testcase for scalbn.
Bernd
commit 5f170b2710aaa5e098d74c71fcd206ef209f0b60
Author: Bernd Schmidt <bernds@codesourcery.com>
Date: Wed Sep 10 18:02:53 2014 +0200
Fix type mismatches in intrinsic functions.
* f95-lang.c (gfc_init_builtin_functions): Use type index 2 for
scalbn, scalbnl and scalbnf.
* mathbuiltins.def (JN, YN): Use type index 5.
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index da3a0d0..e485201 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -784,11 +784,11 @@ gfc_init_builtin_functions (void)
gfc_define_builtin ("__builtin_fabsf", mfunc_float[0],
BUILT_IN_FABSF, "fabsf", ATTR_CONST_NOTHROW_LEAF_LIST);
- gfc_define_builtin ("__builtin_scalbnl", mfunc_longdouble[5],
+ gfc_define_builtin ("__builtin_scalbnl", mfunc_longdouble[2],
BUILT_IN_SCALBNL, "scalbnl", ATTR_CONST_NOTHROW_LEAF_LIST);
- gfc_define_builtin ("__builtin_scalbn", mfunc_double[5],
+ gfc_define_builtin ("__builtin_scalbn", mfunc_double[2],
BUILT_IN_SCALBN, "scalbn", ATTR_CONST_NOTHROW_LEAF_LIST);
- gfc_define_builtin ("__builtin_scalbnf", mfunc_float[5],
+ gfc_define_builtin ("__builtin_scalbnf", mfunc_float[2],
BUILT_IN_SCALBNF, "scalbnf", ATTR_CONST_NOTHROW_LEAF_LIST);
gfc_define_builtin ("__builtin_fmodl", mfunc_longdouble[1],
diff --git a/gcc/fortran/mathbuiltins.def b/gcc/fortran/mathbuiltins.def
index d5bf60d..d06a90b 100644
--- a/gcc/fortran/mathbuiltins.def
+++ b/gcc/fortran/mathbuiltins.def
@@ -42,10 +42,10 @@ DEFINE_MATH_BUILTIN_C (TAN, "tan", 0)
DEFINE_MATH_BUILTIN_C (TANH, "tanh", 0)
DEFINE_MATH_BUILTIN (J0, "j0", 0)
DEFINE_MATH_BUILTIN (J1, "j1", 0)
-DEFINE_MATH_BUILTIN (JN, "jn", 2)
+DEFINE_MATH_BUILTIN (JN, "jn", 5)
DEFINE_MATH_BUILTIN (Y0, "y0", 0)
DEFINE_MATH_BUILTIN (Y1, "y1", 0)
-DEFINE_MATH_BUILTIN (YN, "yn", 2)
+DEFINE_MATH_BUILTIN (YN, "yn", 5)
DEFINE_MATH_BUILTIN (ERF, "erf", 0)
DEFINE_MATH_BUILTIN (ERFC, "erfc", 0)
DEFINE_MATH_BUILTIN (TGAMMA,"tgamma", 0)