------- Comment #2 from janus at gcc dot gnu dot org 2009-05-07 21:44 ------- Here is a preliminary patch which correctly rejects the code in comment #0:
Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 147246) +++ gcc/fortran/interface.c (working copy) @@ -873,23 +873,29 @@ which makes this test much easier than that for generic tests. This subroutine is also used when comparing a formal and actual - argument list when an actual parameter is a dummy procedure. At - that point, two formal interfaces must be compared for equality - which is what happens here. */ + argument list when an actual parameter is a dummy procedure, and in + procedure pointer assignments. In these cases, two formal interfaces must be + compared for equality which is what happens here. */ static int operator_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2) { for (;;) { + /* Check existence. */ if (f1 == NULL && f2 == NULL) break; if (f1 == NULL || f2 == NULL) return 1; + /* Check type and rank. */ if (!compare_type_rank (f1->sym, f2->sym)) return 1; + /* Check intent. */ + if (f1->sym->attr.intent != f2->sym->attr.intent) + return 1; + f1 = f1->next; f2 = f2->next; } However, it produces three testsuite failures: FAIL: gfortran.dg/defined_operators_1.f90 -O (test for errors, line 14) FAIL: gfortran.dg/interface_19.f90 -O0 (test for excess errors) FAIL: gfortran.dg/proc_ptr_result_1.f90 -O0 (test for excess errors) The last of these three test cases is probably invalid, the second failure seems to be a problem with intrinsics, and about the first one I'm not sure. -- janus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-05-07 21:44:33 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40039