This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: ABSTRACT interfaces + PROCEDURE declarations
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "Tobias Burnus" <burnus at net-b dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Thu, 16 Aug 2007 11:22:39 +0200
- Subject: Re: ABSTRACT interfaces + PROCEDURE declarations
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=psr/a3OLwZVOhd8GfeJso7Cl2a+q/KzIyocE4RxJb4AhTx0xrXZIV1mSO7sWlEkhqkpe010ycSYyDylrX7EKar6rSPNCh1J/1V6sgJoFABXL6lOrukTbb/sye1lVP+7fTTHRf8lDqH8dYt8ieNMTFpXlaAEAL0FuFVQbEZvw+Lk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=AiuhcgdSDlqASBA0AyN/Y2f4Yr3MY2bg7YbAa9kCW/8E3dJFCFLLmBJlrzFZMAduTBJ95USOJDJbvPUcODw6GImxrPTLAP0Md8SjX6iuMYPoY2AsLSVIIlOqG9paTOLKmgpD3tZh4hZeeEsDE8BrTtRiZa/ZcEnOUHv9S64ZOhA=
- References: <854832d40708150758y52b93dean2cf7c0c9e18978be@mail.gmail.com> <46C32169.20205@net-b.de>
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