This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ABSTRACT interfaces + PROCEDURE declarations


2007/8/15, Tobias Burnus <burnus@net-b.de>:
> Janus Weil wrote:
> > One thing that I'm working on right now is to implement some checking
> > if the FUNCTION implementation actually matches the PROCEDURE
> > declaration. I've already added some code in decl.c
> >
> As you wrote yourself, the checking in decl.c comes too early. You need
> to put the checking into resolve.c. (I have not yet thought about where
> in resolve.c.) Keep in mind that there are also intrinsic functions,
> some of which can take arguments of different kinds (though not all are
> allowed, cf. C1212/R1215) -- and remember also that implicit interfaces
> are also possible: "PROCEDURE(REAL) ::PSI" to quote the Fortran 2003
> standard.

I would also have guessed that the checking needs to happen in
resolve.c, but the basic problem here seems to be that we need to have
all the information about the procedure interface (as declared in the
PROCEDURE statement) present at that point, which is not the case in
the first place.

Paul Thomas did some kind of "quick 'n' dirty" solution for this, i.e.
he put the interface symbol into the sym->formal field of the
procedure. This was probably intended mainly for procedure pointers,
where it could work out. But if the procedure is actually implemented
by some function or subroutine the sym->formal will be overridden by
the actual formal args and the information on the interface in lost.

The cleanest solution for this would probably be to add an extra field
for the procedure interface somewhere in gfc_symbol or gfc_typespec. I
had a look at the g95 sources, and they have a "sym->ts.interface"
field which holds the symbol for the procedure interface. Probably we
should do the same. What do you think? Should we put this field in
gfc_symbol or gfc_typespec?

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]