Increase GFC_MAX_MANGLED_SYMBOL_LEN to handle submodule names.
authorAndrew Benson <abenson@carnegiescience.edu>
Tue, 28 Jan 2020 18:12:23 +0000 (18:12 +0000)
committerAndrew Benson <abenson@carnegiescience.edu>
Tue, 28 Jan 2020 18:12:23 +0000 (18:12 +0000)
        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
gcc/fortran/trans.h
gcc/testsuite/gfortran.dg/pr93461.f90 [new file with mode: 0644]

index 3e8a24ce8cf2668cc92b1b93bf23942b940929a4..0033246b9924df172c2ae3caded4e690fbba3aeb 100644 (file)
@@ -1,3 +1,11 @@
+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
index 52bc045799a86512ee4163d06ce4e85ac9b58f32..69171f3d0f22440f8493f4f561df691d02e4a6a9 100644 (file)
@@ -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 (file)
index 0000000..3bef326
--- /dev/null
@@ -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