From: Thomas Koenig Date: Sun, 10 Mar 2019 11:09:30 +0000 (+0000) Subject: re PR fortran/87734 (ICE in is_illegal_recursion check for character len= parameter) X-Git-Tag: releases/gcc-7.5.0~551 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87f20bdbb09bc212b90d1f68039ef0f6adfab40a;p=thirdparty%2Fgcc.git re PR fortran/87734 (ICE in is_illegal_recursion check for character len= parameter) 2019-03-10 Thomas Koenig Steven G. Kargl 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 PR fortran/87734 Backport from trunk * gfortran.dg/public_private_module_10.f90: New test. Co-Authored-By: Steven G. Kargl From-SVN: r269550 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 37b651ad812c..12fd22b974b8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2019-03-10 Thomas Koenig + Steven G. Kargl + + 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 PR fortran/72714 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 517d5a7b1754..076e58012ae5 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -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; diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 7b884c332102..9b9c978f2b2f 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb8077a41329..a878fd58fab7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-03-10 Thomas Koenig + + PR fortran/87734 + Backport from trunk + * gfortran.dg/public_private_module_10.f90: New test. + 2019-04-10 Matthias Klose 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 index 000000000000..1877cc232796 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/public_private_module_10.f90 @@ -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