https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86248
--- Comment #4 from Harald Anlauf <anlauf at gmx dot de> --- Some digging shows that the name mangling is done in trans-decl.c, gfc_sym_mangled_identifier. Strangely, the funny name mangling comes from the component fn_result_spec being set in resolve.c, flag_fn_result_spec, but only when darray_fixed is a PARAMETER. The code in question was added by pault in rev. 243478: 243478 pault if (!s->fn_result_spec 243478 pault && s->attr.flavor == FL_PARAMETER) 243478 pault { 243478 pault /* Function contained in a module.... */ 243478 pault if (ns->proc_name && ns->proc_name->attr.flavor == FL_MODULE) 243478 pault { 243478 pault gfc_symtree *st; 243478 pault s->fn_result_spec = 1; Maybe he can shine some light on this.