http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59493
--- Comment #5 from janus at gcc dot gnu.org ---
Here is a simpler patch (which could even be considered for backporting to
4.8):
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 205982)
+++ gcc/fortran/class.c (working copy)
@@ -2424,7 +2424,7 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts)
return NULL;
/* Sometimes the typespec is passed from a single call. */
- if (ts->type == BT_DERIVED)
+ if (ts->type == BT_DERIVED || ts->type == BT_CLASS)
return gfc_find_derived_vtab (ts->u.derived);
/* Find the top-level namespace. */