------- Comment #2 from rguenther at suse dot de 2009-08-04 08:14 ------- Subject: Re: FAIL: gfortran.dg/proc_ptr_7.f90
On Mon, 3 Aug 2009, burnus at gcc dot gnu dot org wrote: > ------- Comment #1 from burnus at gcc dot gnu dot org 2009-08-03 23:17 > ------- > > I see the Fortran FE accepts excess parameters to functions and only warns > > for that with -fwhole-file ... > > Well, that's not surprising - if the function is not in CONTAINS > (internal/module procedure) or in a module, the prototype is not available in > Fortran thus it is just an external procedure without any known interface > (even > if it is just one line higher up). Ah, ok. > One purpose of -fwhole-file is to allow to diagnose such things as error. > > * * * > > I think this is fixed by the following patch. If I understand the code > correctly, we currently only append the void_type_node if there is at least > one > argument, which allows for "(...)" for procedures without any argument. Well, I think you are building a new fndecl at callsites with a prototype that matches the actual arguments passed. > Index: gcc/fortran/trans-types.c > =================================================================== > --- gcc/fortran/trans-types.c (Revision 150376) > +++ gcc/fortran/trans-types.c (Arbeitskopie) > @@ -2324,8 +2324,7 @@ gfc_get_function_type (gfc_symbol * sym) > while (nstr--) > typelist = gfc_chainon_list (typelist, gfc_charlen_type_node); > > - if (typelist) > - typelist = gfc_chainon_list (typelist, void_type_node); > + typelist = gfc_chainon_list (typelist, void_type_node); > > if (alternate_return) > type = integer_type_node; That looks correct to me. Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40949