aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Benson <abenson@carnegiescience.edu>2020-01-28 18:12:23 +0000
committerAndrew Benson <abenson@carnegiescience.edu>2020-01-28 18:12:23 +0000
commitad690d79cfbb905c5546c9333c5fd089d906505b (patch)
treefb438caef385228d05ed42b6db90c165a5d5e718
parenta83b5cc5828ee34471de415e8893242dd3b0a91b (diff)
downloadgcc-ad690d79cfbb905c5546c9333c5fd089d906505b.zip
gcc-ad690d79cfbb905c5546c9333c5fd089d906505b.tar.gz
gcc-ad690d79cfbb905c5546c9333c5fd089d906505b.tar.bz2
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.
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/trans.h4
-rw-r--r--gcc/testsuite/gfortran.dg/pr93461.f9022
3 files changed, 32 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 3e8a24c..0033246 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,13 @@
2020-01-28 Andrew Benson <abensonca@gmail.com>
+ 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 <abensonca@gmail.com>
+
PR fortran/93473
* parse.c: Increase length of char variables to allow them to hold
a concatenated module + submodule name.
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 52bc045..69171f3 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 0000000..3bef326
--- /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