From ad690d79cfbb905c5546c9333c5fd089d906505b Mon Sep 17 00:00:00 2001 From: Andrew Benson Date: Tue, 28 Jan 2020 18:12:23 +0000 Subject: [PATCH] Increase GFC_MAX_MANGLED_SYMBOL_LEN to handle submodule names. PR fortran/93461 * trans.h: Increase GFC_MAX_MANGLED_SYMBOL_LEN to GFC_MAX_SYMBOL_LEN*3+5 to allow for inclusion of submodule name, plus the "." between module and submodule names. * gfortran.dg/pr93461.f90: New test. --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/trans.h | 4 ++-- gcc/testsuite/gfortran.dg/pr93461.f90 | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr93461.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3e8a24ce8cf..0033246b992 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2020-01-28 Andrew Benson + + PR fortran/93461 + * trans.h: Increase GFC_MAX_MANGLED_SYMBOL_LEN to + GFC_MAX_SYMBOL_LEN*3+5 to allow for inclusion of submodule name, + plus the "." between module and submodule names. + * gfortran.dg/pr93461.f90: New test. + 2020-01-28 Andrew Benson PR fortran/93473 diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 52bc045799a..69171f3d0f2 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see #include "predict.h" /* For enum br_predictor and PRED_*. */ -/* Mangled symbols take the form __module__name. */ -#define GFC_MAX_MANGLED_SYMBOL_LEN (GFC_MAX_SYMBOL_LEN*2+4) +/* Mangled symbols take the form __module__name or __module.submodule__name. */ +#define GFC_MAX_MANGLED_SYMBOL_LEN (GFC_MAX_SYMBOL_LEN*3+5) /* Struct for holding a block of statements. It should be treated as an opaque entity and not modified directly. This allows us to change the diff --git a/gcc/testsuite/gfortran.dg/pr93461.f90 b/gcc/testsuite/gfortran.dg/pr93461.f90 new file mode 100644 index 00000000000..3bef326172f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr93461.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! PR fortran/93461 +module aModuleWithAnAllowedName + interface + module subroutine aShortName() + end subroutine aShortName + end interface +end module aModuleWithAnAllowedName + +submodule (aModuleWithAnAllowedName) aSubmoduleWithAVeryVeryVeryLongButEntirelyLegalName +contains + subroutine aShortName() + call aSubroutineWithAVeryLongNameThatWillCauseAProblem() + call aSubroutineWithAVeryLongNameThatWillCauseAProblemAlso() + end subroutine aShortName + + subroutine aSubroutineWithAVeryLongNameThatWillCauseAProblem() + end subroutine aSubroutineWithAVeryLongNameThatWillCauseAProblem + + subroutine aSubroutineWithAVeryLongNameThatWillCauseAProblemAlso() + end subroutine aSubroutineWithAVeryLongNameThatWillCauseAProblemAlso +end submodule aSubmoduleWithAVeryVeryVeryLongButEntirelyLegalName -- 2.30.2