------- Comment #2 from janus at gcc dot gnu dot org  2010-09-15 14:46 -------
(In reply to comment #0)
> Index: fortran/interface.c
> ===================================================================
> --- fortran/interface.c (revision 164288)
> +++ fortran/interface.c (working copy)
> @@ -1428,10 +1428,12 @@
>        && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c)
>      return 1;
> 
> -  if (formal->ts.type == BT_CLASS)
> +  if (formal->ts.type == BT_CLASS) {
>      /* Make sure the vtab symbol is present when
>         the module variables are generated.  */
>      gfc_find_derived_vtab (formal->ts.u.derived);
> +    gfc_find_derived_vtab (actual->ts.u.derived);
> +  }
> 
>    if (actual->ts.type == BT_PROCEDURE)
>      {
> 

Actually I think this patch is ok. Are you interested in committing it
yourself? [Note that you'll need an FSF copyright assignment, if you don't
already have one.] Otherwise I can commit it for you.

Side note: One can (should) extend the patch in the following way ...

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c     (revision 164304)
+++ gcc/fortran/interface.c     (working copy)
@@ -1428,10 +1428,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *a
       && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c)
     return 1;

-  if (formal->ts.type == BT_CLASS)
+  if (formal->ts.type == BT_CLASS && actual->ts.type == BT_DERIVED)
     /* Make sure the vtab symbol is present when
        the module variables are generated.  */
-    gfc_find_derived_vtab (formal->ts.u.derived);
+    gfc_find_derived_vtab (actual->ts.u.derived);

   if (actual->ts.type == BT_PROCEDURE)
     {


(I have not regtested this yet.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674

Reply via email to