https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119948

--- Comment #17 from Paul Thomas <pault at gcc dot gnu.org> ---
Comment on attachment 61202
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61202
fix the issues

Hi Steve,

I got to thinking for once. I think that your change to primary.cc has cast the
net a bit too wide and risks turning other kinds of interfaces into variables.
How about the more specific:

diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 161d4c26964..85539612504 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -4391,7 +4391,7 @@ match_variable (gfc_expr **result, int equiv_flag, int
host_flag)
     case FL_PROCEDURE:
       /* Check for a nonrecursive function result variable.  */
       if (sym->attr.function
-         && !sym->attr.external
+         && (!sym->attr.external || sym->abr_modproc_decl)
          && sym->result == sym
          && (gfc_is_function_return_value (sym, gfc_current_ns)
              || (sym->attr.entry

which does the right thing and regtests OK?

Regards

Paul

Reply via email to