This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Fortran, Patch] PR 33917 - PROCEDURE(proc-interface) - ensure proc-interface is resolved
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "Tobias Burnus" <burnus at net-b dot de>
- Cc: "Paul Richard Thomas" <paul dot richard dot thomas at gmail dot com>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 28 Oct 2007 13:13:16 +0100
- Subject: Re: [Fortran, Patch] PR 33917 - PROCEDURE(proc-interface) - ensure proc-interface is resolved
- References: <47235A87.7060703@net-b.de>
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