]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/87734 (ICE in is_illegal_recursion check for character len= parameter)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 10 Mar 2019 11:09:30 +0000 (11:09 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 10 Mar 2019 11:09:30 +0000 (11:09 +0000)
2019-03-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/87734
Backort from trunk
* symbol.c (gfc_add_procedure): Only throw an error if the
procedure has not been declared either PUBLIC or PRIVATE.
* resolve.c (is_illegal_recursion): Remove an assert().

2019-03-10  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/87734
Backport from trunk
* gfortran.dg/public_private_module_10.f90: New test.

Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r269550

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/public_private_module_10.f90 [new file with mode: 0644]

index 37b651ad812cf4ca5586dc93a06f14c41fd11817..12fd22b974b8bac26dadc859275fa48463f57e91 100644 (file)
@@ -1,3 +1,12 @@
+2019-03-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
+       Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/87734
+       Backort from trunk
+       * symbol.c (gfc_add_procedure): Only throw an error if the
+       procedure has not been declared either PUBLIC or PRIVATE.
+       * resolve.c (is_illegal_recursion): Remove an assert().
+
 2019-03-06  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/72714
index 517d5a7b1754c52362e643a2e8211d8cd8b390d4..076e58012ae58620fbfcd1f2a44f5ac13cb532f7 100644 (file)
@@ -1576,8 +1576,6 @@ is_illegal_recursion (gfc_symbol* sym, gfc_namespace* context)
       || gfc_fl_struct (sym->attr.flavor))
     return false;
 
-  gcc_assert (sym->attr.flavor == FL_PROCEDURE);
-
   /* If we've got an ENTRY, find real procedure.  */
   if (sym->attr.entry && sym->ns->entries)
     proc_sym = sym->ns->entries->sym;
index 7b884c332102eeffcd7295542cbf6259f69c353b..9b9c978f2b2f8c8feadb20a51699a549e78de54b 100644 (file)
@@ -1711,7 +1711,8 @@ gfc_add_procedure (symbol_attribute *attr, procedure_type t,
   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))
index bb8077a41329f05398be4369a1d003f31a2da859..a878fd58fab774ef8ec24b716c8f8cf50d40685c 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/87734
+       Backport from trunk
+       * gfortran.dg/public_private_module_10.f90: New test.
+
 2019-04-10  Matthias Klose  <doko@ubuntu.com>
 
        Backport from the gcc-8 branch
diff --git a/gcc/testsuite/gfortran.dg/public_private_module_10.f90 b/gcc/testsuite/gfortran.dg/public_private_module_10.f90
new file mode 100644 (file)
index 0000000..1877cc2
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR 87734 - this used to issue spurious errors.
+
+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