From: Andrew Benson Date: Tue, 28 Jan 2020 17:58:40 +0000 (+0000) Subject: Allow concatenated module+submodule names. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a83b5cc5828ee34471de415e8893242dd3b0a91b;p=gcc.git Allow concatenated module+submodule names. Increase length of char variables "parent1" and "parent2" in set_syms_host_assoc() to allow them to hold concatenated module + submodule names. PR fortran/93473 * parse.c: Increase length of char variables to allow them to hold a concatenated module + submodule name. * gfortran.dg/pr93473.f90: New test. --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c7e2b319337..3e8a24ce8cf 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2020-01-28 Andrew Benson + + PR fortran/93473 + * parse.c: Increase length of char variables to allow them to hold + a concatenated module + submodule name. + * gfortran.dg/pr93473.f90: New test. + 2020-01-28 Julian Brown PR fortran/93025 diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 4bff0c885e2..f71a95dd871 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -6045,8 +6045,9 @@ set_syms_host_assoc (gfc_symbol *sym) { gfc_component *c; const char dot[2] = "."; - char parent1[GFC_MAX_SYMBOL_LEN + 1]; - char parent2[GFC_MAX_SYMBOL_LEN + 1]; + /* Symbols take the form module.submodule_ or module.name_. */ + char parent1[2 * GFC_MAX_SYMBOL_LEN + 2]; + char parent2[2 * GFC_MAX_SYMBOL_LEN + 2]; if (sym == NULL) return; diff --git a/gcc/testsuite/gfortran.dg/pr93473.f90 b/gcc/testsuite/gfortran.dg/pr93473.f90 new file mode 100644 index 00000000000..dda8525cfd9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr93473.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! { dg-options "-ffree-line-length-none" } +! PR fortran/93473 +module aModestlyLongModuleName + + type :: aTypeWithASignificantlyLongNameButStillAllowedOK + end type aTypeWithASignificantlyLongNameButStillAllowedOK + + interface + module function aFunctionWithALongButStillAllowedName(parameters) result(self) + type(aTypeWithASignificantlyLongNameButStillAllowedOK) :: self + end function aFunctionWithALongButStillAllowedName + end interface + +end module aModestlyLongModuleName + +submodule (aModestlyLongModuleName) aTypeWithASignificantlyLongNameButStillAllowedOK_ + +contains + + module procedure aFunctionWithALongButStillAllowedName + class(*), pointer :: genericObject + end procedure aFunctionWithALongButStillAllowedName + +end submodule aTypeWithASignificantlyLongNameButStillAllowedOK_ + +submodule (aModestlyLongModuleName:aTypeWithASignificantlyLongNameButStillAllowedOK_) aSubmoduleWithASignificantlyLongButStillAllowedName__ +end submodule aSubmoduleWithASignificantlyLongButStillAllowedName__