https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105138
--- Comment #8 from kargl at gcc dot gnu.org --- This patch fixes the error. The comment in the patch explains it. diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc index 52e5f4ed39e..ec833667dbe 100644 --- a/gcc/fortran/intrinsic.cc +++ b/gcc/fortran/intrinsic.cc @@ -1167,6 +1167,11 @@ gfc_is_intrinsic (gfc_symbol* sym, int subroutine_flag, locus loc) || sym->attr.if_source == IFSRC_IFBODY) return false; + /* If the function has a result-name and it's recursive, it cannot be + an intrinsic subprogram. */ + if (sym->result && sym->attr.recursive) + return false; + if (subroutine_flag) isym = gfc_find_subroutine (sym->name); else