Seek help with PR 33917 (PROCEDUREs)

Jerry DeLisle jvdelisle@verizon.net
Fri Nov 9 01:54:00 GMT 2007


Tobias Burnus wrote:
> Hi all,
> 
> using
>   PROCEDURE(procedure_name) :: name
> one can declare an (external) procedure, which uses the interface of
> "procedure_name".
> 
> procedure_name has the following constrains:
> 
> "C1212 (R1215) The name shall be the name of an abstract interface or of a
> procedure that has an explicit interface. If name is declared by a
> procedure-declaration-stmt it shall be previously declared. If name denotes
> an intrinsic procedure it shall be one that is listed in 13.6 and not
> marked
> with a bullet (.)"
> 
> The problem is that "procedure_name" cannot be resolved in decl.c as it
> is unknown which contained procedures come later. Thus the interfaces
> are resolved in resolve.c.
> 
> Now, I want to check for the restriction "If name is declared by a
> procedure-declaration-stmt it shall be previously declared." But how? I
> don't see any possibility in decl.c and for resolve.c, the order depends
> on how the tree is walked, which is in general not the order in the file.
> 
> I was initially thinking of
>   if(interface->attr.procedure
>      && sym->declared [before] interface->declared) { error }
> However, this does not work as the symbol interface of is resolved
> before. Additionally, I don't know how to check for this condition,
> especially in e.g. the following case, where everything is in one line:
>  PROCEDURE(t) :: a; PROCEDURE(cos) :: t
> 
> Any idea?
> 
> Tobias
> 
I am working this particular issue as part of pr33162.  I am thinking that you 
have to use gfc_get_** to find it.  There is a version to find intrinsic 
functions and another for other functions.  This will return a pointer to the 
symbol so that you can do what you need.

There is some overlap in these two PRS.  If you can not find the procedure name 
using the aforementioned functions, then you have your basis for an error.

Jerry



More information about the Fortran mailing list