http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-05-09 09:55:30 UTC --- The problem is that gfc_check_typebound_override calls check_dummy_characteristics -> compare_type_rank -> gfc_compare_types But the latter accepts a type extension, which means that one has to also check the reverse. Patch: --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -4130,2 +4130,13 @@ gfc_check_typebound_override (gfc_symtree* proc, gfc_symtree* old) check_type = proc_pass_arg != argpos && old_pass_arg != argpos; + if (check_type + && (!gfc_compare_types (&proc_formal->sym->ts, &old_formal->sym->ts) + || !gfc_compare_types (&old_formal->sym->ts, + &proc_formal->sym->ts))) + { + gfc_error ("Argument type mismatch for the overriding procedure " + "'%s' at %L: %s vs %s", proc->name, &where, + gfc_typename (&proc_formal->sym->ts), + gfc_typename (&old_formal->sym->ts)); + return false; + } if (!check_dummy_characteristics (proc_formal->sym, old_formal->sym,