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

--- Comment #7 from janus at gcc dot gnu.org ---
The following patch fixes both variants (comment 1 and comment 5):


Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 201238)
+++ gcc/fortran/resolve.c    (working copy)
@@ -5686,7 +5686,9 @@ resolve_compcall (gfc_expr* e, const char **name)
 }


+static bool resolve_fl_derived (gfc_symbol *sym);

+
 /* Resolve a typebound function, or 'method'. First separate all
    the non-CLASS references by calling resolve_compcall directly.  */

@@ -5772,6 +5774,9 @@ resolve_typebound_function (gfc_expr* e)

   /* Get the CLASS declared type.  */
   declared = get_declared_from_expr (&class_ref, &new_ref, e, true);
+  
+  if (!resolve_fl_derived (declared))
+    return false;

   /* Weed out cases of the ultimate component being a derived type.  */
   if ((class_ref && class_ref->u.c.component->ts.type == BT_DERIVED)



The problem was actually that the TBP was not properly resolved (or more
precisely: that the resolution came too late), so that the FUNCTION attribute
was not yet set. Regtesting now ...

Reply via email to