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

--- Comment #5 from janus at gcc dot gnu.org ---
The following patch also fixes the problem:


diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 03298833c98..83fc6c29b5a 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -6754,7 +6754,7 @@ match_ppc_decl (void)
   gfc_clear_attr (&current_attr);
   current_attr.procedure = 1;
   current_attr.proc_pointer = 1;
-  current_attr.access = tb->access;
+  current_attr.access = gfc_current_block()->component_access;
   current_attr.flavor = FL_PROCEDURE;

   /* Match the colons (required).  */


I think this approach is better than the one in comment 4.

There are two kinds of default access: One for components, one for type-bound
procedures. For procedure-pointer components, gfortran currently applies the
TBP default access. I think this is wrong (since PPCs are declared in the
component part, not in the TBP part of a type declaration). The above patch
fixes it.

Reply via email to