This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Fortran, Patch] PR 33917 - PROCEDURE(proc-interface) - ensure proc-interface is resolved
- From: "Paul Richard Thomas" <paul dot richard dot thomas at gmail dot com>
- To: "Tobias Burnus" <burnus at net-b dot de>
- Cc: "Janus Weil" <jaydub66 at googlemail 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 07:29:22 +0200
- Subject: Re: [Fortran, Patch] PR 33917 - PROCEDURE(proc-interface) - ensure proc-interface is resolved
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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; bh=ADbfCxkCmHOLkE1FO2mjmixc7QXqeOO0gBwyMwSDubM=; b=iFLvRoZGkLyFVJV44q23BqdWhSnBlFWCLMqXK7nLtEer+4xowNi4s8mnwtWR6JiTWPCfMOGtSPc4awHNDYrz2lsDG5SMi0aJCBSg7U8IlMnr2TX33IAlpMmP4rOAEDukb83/VUjWPl9mQnTk5rFzvNOxWfPeoB1PLGMVNCslM88=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.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=DLOzxekpFXUuAZRm0FPPjF8+WUDO6czqZH0htPksNx/w+gzZw52I0Z24YgOlUc9HxVC+9uk0rWGAP8ah11gqQHecQpsOmRbV/zy7ce2ECfQTuWpxARUOCfWjuROhS85q3btlRCGv0+gqvUj0UYf0BRnVLdsQx7lM9K28QjJwHyk=
- References: <47235A87.7060703@net-b.de>
Tobias,
I am having an extremely pressed time at the moment and do not think
that I can reply reliably. I just got in from Wien and am then on my
way to Barcelona in three hours. It goes on like this for another two
weeks. If this is still a problem then, I'll gladly take a look.
Cheers
Paul
On 10/27/07, Tobias Burnus <burnus@net-b.de> wrote:
> Hi all, hi Janus and Thomas,
>
> :ADDPATCH fortran:
>
> Currently,
>
> ! sub be a procedure with an explicit interface
> procedure(sub) :: p4
> procedure(p4) :: p6
>
> fails if the symbol p6 is resolved before p4 as then
> p6->interface->attr.if_source is IFSRC_UNKNOWN.
>
> Whether it fails, depends how one walks the symbol tree. See PR33917 for
> an example which fails, unless you comment a line.
>
> The following patch simply checks whether the proc-interface symbol in
> "PROCEDURE([proc-interface])" has already a non-NULL sym->interface and,
> if yes, it uses it then instead of using "sym" itself.
>
> I think in terms of copying attributes this should be ok; however, I
> would not mind if you try to come up with a reason why this is wrong
> (wrong/missing attributes, memory leak, ...) or whether there is still a
> case for which it will (still) fail.
>
> Do you would like to see a comment above the added line or is its
> meaning clear?
>
> Built and regression tested on x86-64-linux.
> OK for the trunk?
>
> Tobias
>
> 2007-10-27 Tobias Burnus <burnus@net-b.de>
>
> PR fortran/33917
> * decl.c (match_procedure_decl): If available, use directly
> the procedure interface.
>
> 2007-10-27 Tobias Burnus <burnus@net-b.de>
>
> PR fortran/33917
> * gfortran.dg/proc_decl_5.f90: New.
>
> Index: gcc/fortran/decl.c
> ===================================================================
> --- gcc/fortran/decl.c (Revision 129680)
> +++ gcc/fortran/decl.c (Arbeitskopie)
> @@ -3920,6 +3920,9 @@ match_procedure_decl (void)
> /* 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);
> Index: gcc/testsuite/gfortran.dg/proc_decl_5.f90
> ===================================================================
> --- gcc/testsuite/gfortran.dg/proc_decl_5.f90 (Revision 0)
> +++ gcc/testsuite/gfortran.dg/proc_decl_5.f90 (Revision 0)
> @@ -0,0 +1,20 @@
> +! { dg-do compile }
> +! PR fortran/33917
> +!
> +! Depending in which order the symbol tree
> +! was walked in resolve, gfortran resolved
> +! p6 before p4; thus there was no explicit
> +! interface available for p4 and an error
> +! was printed.
> +!
> +program s
> + implicit none
> + procedure() :: q2
> + procedure() :: q3
> + procedure() :: q5
> + procedure(sub) :: p4
> + procedure(p4) :: p6
> +contains
> + subroutine sub
> + end subroutine
> +end program s
>
>
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy