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

--- Comment #8 from janus at gcc dot gnu.org ---
This should finally be the proper fix:

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 03298833c98..3d19ad479e5 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -10570,7 +10570,8 @@ match_binding_attributes (gfc_typebound_proc* ba, bool
generic, bool ppc)

 done:
   if (ba->access == ACCESS_UNKNOWN)
-    ba->access = gfc_typebound_default_access;
+    ba->access = ppc ? gfc_current_block()->component_access
+                     : gfc_typebound_default_access;

   if (ppc && !seen_ptr)
     {

Reply via email to