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

Janus Weil jaydub66@googlemail.com
Wed Jun 4 20:11:00 GMT 2008


> 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);


This actually won't work since the added line overwrites
"sym->ts.interface" (which then will be NULL), but the three following
lines depend on it.
What do you think about the last version that I sent before
(pr36322_v2.diff)? I think it should do what we need, and I have
already regtested it succesfully.

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 136328)
+++ gcc/fortran/resolve.c	(working copy)
@@ -7847,6 +7847,7 @@ resolve_symbol (gfc_symbol *sym)
   gfc_symtree *this_symtree;
   gfc_namespace *ns;
   gfc_component *c;
+  gfc_symbol *ifc;

   if (sym->attr.flavor == FL_UNKNOWN)
     {
@@ -7893,11 +7894,12 @@ 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->attr.function = sym->ts.interface->attr.function;
-	  sym->attr.subroutine = sym->ts.interface->attr.subroutine;
-	  copy_formal_args (sym, sym->ts.interface);
+	  ifc = sym->ts.interface;
+	  sym->ts = ifc->ts;
+	  sym->ts.interface = ifc;
+	  sym->attr.function = ifc->attr.function;
+	  sym->attr.subroutine = ifc->attr.subroutine;
+	  copy_formal_args (sym, ifc);
 	}
       else if (sym->ts.interface->name[0] != '\0')
 	{



More information about the Fortran mailing list