http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48279
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-03-28 13:21:30 UTC --- ==1823== Invalid read of size 1 ==1823== at 0x4C32E7: gfc_check_vardef_context (expr.c:4377) ==1823== by 0x4CBC25: compare_actual_formal (interface.c:2291) ==1823== by 0x4CD48B: gfc_arglist_matches_symbol (interface.c:2813) ==1823== by 0x4CD6F4: gfc_search_interface (interface.c:2842) ==1823== by 0x50D2A2: resolve_call (resolve.c:3204) The issue - or at least cause - for the segfault is the following code in gfc_check_vardef_context: if (!pointer && e->expr_type == EXPR_FUNCTION && e->symtree->n.sym->result->attr.pointer) The problem is that e->symtree->n.sym->result == NULL. The symbol itself is "get_d_string". If one uses gdb's "set e->symtree->n.sym->result = e->symtree->n.sym" and continues, one gets the expected error: Error: There is no specific subroutine for the generic 'set' at (1) One problem seems to be that "get_d_string" is a generic interface - and not a specific one: (gdb) p e->symtree->n.sym->attr.generic $1 = 1 The specific interface has properly the result variables set: (gdb) p e->symtree->n.sym->generic->sym->name $3 = 0x2aaaae876280 "get_d_string_p" (gdb) p e->symtree->n.sym->generic->sym->result $4 = (struct gfc_symbol *) 0x1281280 Calling gfc_check_vardef_context for an generic interface seems to be questionable.