https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58331
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #4 from anlauf at gcc dot gnu.org --- (In reply to Tobias Burnus from comment #2) > Updated patch: > --- a/gcc/fortran/interface.c > +++ b/gcc/fortran/interface.c > @@ -2135 +2135,5 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, > - || (actual->rank != 0 && !(is_elemental || formal->attr.dimension)) > + || (actual->rank != 0 > + && !(is_elemental > + || (formal->ts.type != BT_CLASS && formal->attr.dimension) > + || (formal->ts.type == BT_CLASS > + && CLASS_DATA (formal)->attr.dimension))) > @@ -2142 +2146,4 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, > - || (actual->rank == 0 && formal->attr.dimension > + || (actual->rank == 0 > + && (formal->attr.dimension > + || (formal->ts.type == BT_CLASS > + && CLASS_DATA (formal)->attr.dimension)) > @@ -2150 +2157,4 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, > - else if (actual->rank != 0 && (is_elemental || formal->attr.dimension)) > + else if (actual->rank != 0 > + && (is_elemental || formal->attr.dimension > + || (formal->ts.type == BT_CLASS > + && CLASS_DATA (formal)->attr.dimension))) When adapting this patch to mainline it seems to work now and regtests ok. Printing array a in mysub gives the right results, and also the tree dump for the call with rank-2 argument looks slightly different: parm.12.data = (void *) &b[0]; parm.12.offset = -3; class.11._data = VIEW_CONVERT_EXPR<struct array01_unknown>(parm.12); class.11._len = 0; mysub (&class.11, &C.4379); So shall we proceed?