[Patch, Fortran] ICE with PROCEDURE using a complicated interface (PR36322 & PR36275)

Tobias Burnus burnus@net-b.de
Wed Jun 4 19:42:00 GMT 2008


Janus Weil wrote:
> /* Character length structures hold the expression that gives the
>    length of a character variable.  We avoid putting these into
>    gfc_typespec because doing so prevents us from doing structure
>    copies and forces us to deallocate any typespecs we create, as well
>    as structures that contain typespecs.  They also can have multiple
>    character typespecs pointing to them.
I interpret the last sentence such that a ts->cl can be shared by 
several "ts". This is also in line with the source code, where "cl" is 
never freed. (Well, there are two special cases where they are freed, 
but those don't apply.)

Thus I believe the following patch should be enough. (For check in one 
then additionally needs the test cases.)

If you agree, you could check in this (obvious) patch together with your 
test cases - after the obligatory building of gcc and running of  make 
check-gfortran.

Tobias

Index: resolve.c
===================================================================
--- resolve.c   (Revision 136360)
+++ resolve.c   (Arbeitskopie)
@@ -7893,8 +7893,7 @@ resolve_symbol (gfc_symbol *sym)
       /* Get the attributes from the interface (now resolved).  */
       if (sym->ts.interface->attr.if_source || sym->ts.interface->attr.intrinsic)
        {
-         sym->ts.type = sym->ts.interface->ts.type;
-         sym->ts.kind = sym->ts.interface->ts.kind;
+         sym->ts = sym->ts.interface->ts;
          sym->attr.function = sym->ts.interface->attr.function;
          sym->attr.subroutine = sym->ts.interface->attr.subroutine;
          copy_formal_args (sym, sym->ts.interface);





More information about the Fortran mailing list