http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39290
--- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> 2013-04-29 10:59:51 UTC --- The following excerpt from gfc_compare_interfaces(interface.c) seems to be the cause of 'qc' being called: if (s1->attr.function && s2->attr.function) { /* If both are functions, check result characteristics. */ if (!check_result_characteristics (s1, s2, errmsg, err_len)) return 0; } s2 is 'ff', and s2->attr.function is false, so we don't check function results, and the 'qc' interface matches. There are a quite a few problems it seems: 1. we rely on s1->attr.function _and_ s2->attr.function being set, which is obviously not the case with implicit typing. 2. check_result_characteristics will call gfc_compare_types, so it needs properly set types (no BT_UNKNOWN). 3. gfc_search_interface returns the first match, so it doesn't detect multiple matches (which would reject this case and avoid generating wrong code here). 4. Implicit typing depends on how the symbol is used, so basically on the available interfaces, but that itself needs implicit typing being resolved (see 1. and 2.) Good luck to whoever wants to fix this.