ABSTRACT interfaces + PROCEDURE declarations

Janus Weil jaydub66@googlemail.com
Thu Aug 16 13:21:00 GMT 2007


> > 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.
> >
> It was indeed a quick and dirty solution; however, there is no reason
> why it should not work fine, even when the procedure is not a pointer.
> After all, the procedure attribute flags that the first formal symbol is
> the interface symbol and its formal arguments can be used instead of
> that of the procedure.  I'm not proposing that you should do that but am
> just pointing out that it would work perfectly well

Ok, maybe it *does* work, but it introduces some problems.
e.g. it makes it quite hard to check the declaration vs.
implementation for correctness and consistency, because the structure
can't hold both the formal args of the PROCEDURE declaration and the
formal args of the actual function implementation at the same time.
And probably it has some more drawbacks of a quick'n'dirty hack.


> > 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?
> >
> Either would be fine.  Perhaps it is time to carry out the TODO in
> gfortran.h and make a union of 'cl' and 'derived' .... + 'interface'?

Ok, so I will go ahead and introduce an interface field into
gfc_typespec, and while I'm at it also make a union out of cl, derived
and interface. Fine with everyone?


> Have you made any progress with the TREE-SSA declaration of a procedure
> pointer?  It is quite obvious, looking back, that I was barking up the
> wrong tree completely.  Do you want me to do some further investigation?

I haven't really thought a lot about the pointer implementation yet,
and I don't know much about the whole TREE-SSA business. So if you
have an idea how to implement this just go ahead. For the moment I
will try to get the basic procedure declarations finished before I
start thinking about pointers. And I can surely use all the help I can
get ;)



More information about the Fortran mailing list