public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Fix some more decl types in the Fortran frontend
@ 2014-09-11 10:37 FX
  2014-09-11 16:31 ` Bernd Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: FX @ 2014-09-11 10:37 UTC (permalink / raw)
  To: Fortran List, gcc-patches, bernds, Tobias Burnus

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:

>   gfc_define_builtin ("__builtin_powi", mfunc_double[2],
>                       BUILT_IN_POWI, "powi", ATTR_CONST_NOTHROW_LEAF_LIST);

(I don’t see any other use of this, but I might be missing something.)

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).

Cheers,
FX

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Fix some more decl types in the Fortran frontend
@ 2014-09-11 10:24 Bernd Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Bernd Schmidt @ 2014-09-11 10:24 UTC (permalink / raw)
  To: GCC Patches, gfortran, Tobias Burnus

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

This shows up as failures of gfortran.dg/bessel_[67].f90 on ptx. 
According to the man page, the correct declarations are

double jn(int n, double x);
double yn(int n, double x);

and our calls match this, but the argument types are switched in the 
decls built by the Fortran frontend. On ptx, such errors are diagnosed 
by the assembler. Fixed by the following patch, bootstrapped and tested 
on x86_64-linux. Ok?

I'm also seeing some new Fortran testsuite failures after the recent 
merge to gomp-4_0-branch, due to a similar issue. That one has been 
harder to figure out, one of the affected tests is 
gfortran.dg/array_assignment_5.f90.  Here, we call 
_gfortran_spread_char_scalar, which is declared in the library as a 
function taking 6 args, and we pass 6 args to it. However, the decl for 
it only has 5 arguments. It's unclear to me where the problem is in the 
construction of the argument list for the decl. I'm also unsure why this 
has shown up only very recently.


Bernd

[-- Attachment #2: gfc-bessel.diff --]
[-- Type: text/x-patch, Size: 1091 bytes --]

commit 87c261fd190c9dea09a793b1295e7cff9bb6044e
Author: Bernd Schmidt <bernds@codesourcery.com>
Date:   Wed Sep 10 18:02:53 2014 +0200

    Fix type mismatches in intrinsic functions.
    
    	* f95-lang.c (build_builtin_fntypes): Switch order of args for type
    	with index 2.

diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index da3a0d0..27cfc87 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -608,9 +608,9 @@ build_builtin_fntypes (tree *fntype, tree type)
   fntype[0] = build_function_type_list (type, type, NULL_TREE);
   /* type (*) (type, type) */
   fntype[1] = build_function_type_list (type, type, type, NULL_TREE);
-  /* type (*) (type, int) */
-  fntype[2] = build_function_type_list (type,
-                                        type, integer_type_node, NULL_TREE);
+  /* type (*) (int, type) */
+  fntype[2] = build_function_type_list (type, integer_type_node, type,
+                                        NULL_TREE);
   /* type (*) (void) */
   fntype[3] = build_function_type_list (type, NULL_TREE);
   /* type (*) (type, &int) */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-13 12:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 10:37 Fix some more decl types in the Fortran frontend FX
2014-09-11 16:31 ` Bernd Schmidt
2014-09-11 16:32   ` FX
2014-09-11 18:43   ` Tobias Burnus
2014-09-11 19:35     ` FX
     [not found]       ` <CAGkQGiJBQDp7izpnofS=MPnVXPuTmakGjYcvyxfv8awX1UOrzg@mail.gmail.com>
2014-09-13 12:53         ` FX
  -- strict thread matches above, loose matches on Subject: below --
2014-09-11 10:24 Bernd Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).