diff mbox

Fix some more decl types in the Fortran frontend

Message ID 5411CE2F.8010401@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt Sept. 11, 2014, 4:30 p.m. UTC
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

Comments

FX Coudert Sept. 11, 2014, 4:32 p.m. UTC | #1
> So it looks like the following patch would be the right thing?

I would think so.

FX
Tobias Burnus Sept. 11, 2014, 6:43 p.m. UTC | #2
On 11.09.2014 18:30, Bernd Schmidt wrote:
> 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.

On 11.09.2014 18:32, FX wrote:
> I would think so.

Looks also good to me. Thanks for the patch, Bernd. And thanks for the 
review, FX. Do you want to undo your Fortran-maintainer → 
mere-contributor status, given that you are now again a bit more 
involved in the GCC development?

Tobias


>      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.
FX Coudert Sept. 11, 2014, 7:34 p.m. UTC | #3
> And thanks for the review, FX. Do you want to undo your Fortran-maintainer → mere-contributor status, given that you are now again a bit more involved in the GCC development?

Yeah, why not. I promise I'll be careful and only review things in my comfort zone (which isn't so large).

I'll wait for a few days before changing the MAINTAINERS file in case someone thinks it's a bad idea.

FX
diff mbox

Patch

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)