http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46196
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2010.10.27 20:32:13 AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #2 from janus at gcc dot gnu.org 2010-10-27 20:32:13 UTC --- Draft patch. It seems to fix this PR as well as all of PR44917 and PR44926. Not tested for regressions yet. Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 165975) +++ gcc/fortran/interface.c (working copy) @@ -872,7 +872,8 @@ count_types_test (gfc_formal_arglist *f1, gfc_form /* Find other nonoptional arguments of the same type/rank. */ for (j = i + 1; j < n1; j++) if ((arg[j].sym == NULL || !arg[j].sym->attr.optional) - && compare_type_rank_if (arg[i].sym, arg[j].sym)) + && (compare_type_rank_if (arg[i].sym, arg[j].sym) + || compare_type_rank_if (arg[j].sym, arg[i].sym))) arg[j].flag = k; k++; @@ -897,7 +898,8 @@ count_types_test (gfc_formal_arglist *f1, gfc_form ac2 = 0; for (f = f2; f; f = f->next) - if (compare_type_rank_if (arg[i].sym, f->sym)) + if (compare_type_rank_if (arg[i].sym, f->sym) + || compare_type_rank_if (f->sym, arg[i].sym)) ac2++; if (ac1 > ac2) @@ -948,7 +950,8 @@ generic_correspondence (gfc_formal_arglist *f1, gf if (f1->sym->attr.optional) goto next; - if (f2 != NULL && compare_type_rank (f1->sym, f2->sym)) + if (f2 != NULL && (compare_type_rank (f1->sym, f2->sym) + || compare_type_rank (f2->sym, f1->sym))) goto next; /* Now search for a disambiguating keyword argument starting at