Hello world,

a recent patch by Steve for PR 88376 fixed an ICE in the test case
for PR 87734, leading further down the path to a rejects-valid bug
in the same test case.  Such is progress :-)

This patch fixes that particular error by not treating module procedures
which have been declared PUBLIC or PRIVATE as simple external
procedures.

This is a 7/8/9 regression, backporting may also include backporting
Steve's patch for PR 88376 (I haven't checked yet).

OK for trunk and the other open branches?

Regards

        Thomas

2019-03-09  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/87734
        * symbol.c (gfc_add_procedure): Only throw an error if the
        procedure has not been declared either PUBLIC or PRIVATE.

2019-03-09  Thomas Koenig  <tkoe...@gcc.gnu.org>

        PR fortran/87734
        * gfortran.dg/public_private_module_10.f90: New test.
Index: symbol.c
===================================================================
--- symbol.c	(Revision 269524)
+++ symbol.c	(Arbeitskopie)
@@ -1805,7 +1805,8 @@ gfc_add_procedure (symbol_attribute *attr, procedu
   if (where == NULL)
     where = &gfc_current_locus;
 
-  if (attr->proc != PROC_UNKNOWN && !attr->module_procedure)
+  if (attr->proc != PROC_UNKNOWN && !attr->module_procedure
+      && attr->access == ACCESS_UNKNOWN)
     {
       if (attr->proc == PROC_ST_FUNCTION && t == PROC_INTERNAL
 	  && !gfc_notification_std (GFC_STD_F2008))
! PR 87734
module m_vstring
  implicit none

  public :: vstring_length

contains

  subroutine vstring_cast()
    character ( len = vstring_length() ) :: char_string
  end subroutine

  pure integer function vstring_length ()
  end function

end module

Reply via email to