https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88047
--- Comment #3 from janus at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #2) > The following patch restores the errors It doesn't seem to cause any regressions in the testsuite either. Feel free to commit this fix, Dominique. Side note: In principle I would have preferred something like this: diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index f22241da60b..e40c23f2a5d 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1374,7 +1374,8 @@ gfc_match_assignment (void) gfc_check_do_variable (lvalue->symtree); - if (lvalue->ts.type == BT_CLASS) + if (lvalue->ts.type == BT_CLASS && (rvalue->ts.type != BT_CLASS + || gfc_expr_attr (rvalue).class_ok)) gfc_find_vtab (&rvalue->ts); return MATCH_YES; But that ICEs on class_array_3.f03.