+2020-03-02 Andrew Benson <abensonca@gmail.com>
+
+ PR fortran/93486
+ * module.c: Increase size of variables used to read module names
+ when loading interfaces from module files to permit cases where
+ the name is the concatenation of a module and submodule name.
+ * gfortran.dg/pr93486.f90: New test.
+
2020-03-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/92976
load_operator_interfaces (void)
{
const char *p;
- char name[GFC_MAX_SYMBOL_LEN + 1], module[GFC_MAX_SYMBOL_LEN + 1];
+ /* "module" must be large enough for the case of submodules in which the name
+ has the form module.submodule */
+ char name[GFC_MAX_SYMBOL_LEN + 1], module[2 * GFC_MAX_SYMBOL_LEN + 2];
gfc_user_op *uop;
pointer_info *pi = NULL;
int n, i;
load_generic_interfaces (void)
{
const char *p;
- char name[GFC_MAX_SYMBOL_LEN + 1], module[GFC_MAX_SYMBOL_LEN + 1];
+ /* "module" must be large enough for the case of submodules in which the name
+ has the form module.submodule */
+ char name[GFC_MAX_SYMBOL_LEN + 1], module[2 * GFC_MAX_SYMBOL_LEN + 2];
gfc_symbol *sym;
gfc_interface *generic = NULL, *gen = NULL;
int n, i, renamed;
--- /dev/null
+! { dg-do compile }
+! PR fortran/93486
+module ivs
+ interface l
+ module procedure l_
+ end interface l
+contains
+ function l_()
+ end function l_
+end module ivs
+
+module aModeratleyLongModuleName
+ use ivs
+ interface
+ module subroutine cmo()
+ end subroutine cmo
+ end interface
+end module aModeratleyLongModuleName
+
+submodule (aModeratleyLongModuleName) aNameForASubmoduleThatIsVeryLongButWhichIsLegalStill
+contains
+ module procedure cmo
+ end procedure cmo
+end submodule aNameForASubmoduleThatIsVeryLongButWhichIsLegalStill
+
+submodule (aModeratleyLongModuleName:aNameForASubmoduleThatIsVeryLongButWhichIsLegalStill) sb
+end submodule sb
+
+submodule (aModeratleyLongModuleName:sb) sc
+end submodule sc