https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96325
--- Comment #10 from kargl at gcc dot gnu.org --- (In reply to jvdelisle from comment #9) > I regression tested the patch in comment 8 and see these failures. > > FAIL: gfortran.dg/pr93423.f90 -O (test for excess errors) > FAIL: gfortran.dg/typebound_call_31.f90 -O (test for errors, line 14) > FAIL: gfortran.dg/typebound_call_31.f90 -O (test for excess errors) Thanks for testing. Does the patch that follows fix the regressions? gfortran treats components and type bound procedures separately. I've (hopefully) adapted the patch to whether foo is either. Index: gcc/fortran/primary.c =================================================================== --- gcc/fortran/primary.c (revision 280157) +++ gcc/fortran/primary.c (working copy) @@ -2240,6 +2240,18 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, inquiry = is_inquiry_ref (name, &tmp); if (inquiry) sym = NULL; + else + { + component = gfc_find_component (sym, name, false, false, &tmp); + tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus); + if (!component && !tbp) + { + gfc_error ("%qs at %C is neither a component nor a type " + "bound procedure of the derived " + "type %qs", name, sym->name); + return MATCH_ERROR; + } + } if (sep == '%' && primary->ts.type != BT_UNKNOWN) intrinsic = true;