[Fortran, Patch] PR 33917 - PROCEDURE(proc-interface) - ensure proc-interface is resolved
Janus Weil
jaydub66@googlemail.com
Sun Oct 28 12:13:00 GMT 2007
Hi Tobi,
first of all: thanks for looking into this. I think your patch looks
pretty good and it works perfectly fine for the given example.
> /* Various interface checks. */
> if (proc_if)
> {
> + if (proc_if->interface)
> + proc_if = proc_if->interface;
> +
> if (proc_if->generic)
> {
> gfc_error ("Interface '%s' at %C may not be generic", proc_if->name);
Nevertheless I'd like to propose two changes:
1) I think those two lines you added should go into resolve.c
(resolve_symbol), to make sure this also works when the lines in the
example are exchanged to:
procedure(p4) :: p6
procedure(sub) :: p4
This case would still give an error with your patch.
2) The "if" should become a "while", to make it work for deeper nesting, as in:
procedure(sub) :: p4
procedure(p4) :: p6
procedure(p6) :: p8
So then the patch would look like this:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (Revision 129686)
+++ gcc/fortran/resolve.c (Arbeitskopie)
@@ -7672,6 +7672,9 @@ resolve_symbol (gfc_symbol *sym)
if (sym->attr.procedure && sym->interface
&& sym->attr.if_source != IFSRC_DECL)
{
+ while (sym->interface->interface)
+ sym->interface = sym->interface->interface;
+
/* Get the attributes from the interface (now resolved). */
if (sym->interface->attr.if_source || sym->interface->attr.intrinsic)
{
Does this make sense to you?
Cheers,
Janus
More information about the Fortran
mailing list