[gcc(refs/vendors/ibm/heads/gcc-9-branch)] PR fortran/95106 - truncation of long symbol names with EQUIVALENCE
Peter Bergner
bergner@gcc.gnu.org
Fri Sep 4 19:16:06 GMT 2020
https://gcc.gnu.org/g:371739d01d00ae4c55902e0937b73ddee7d66391
commit 371739d01d00ae4c55902e0937b73ddee7d66391
Author: Harald Anlauf <anlauf@gmx.de>
Date: Sun May 24 21:35:04 2020 +0200
PR fortran/95106 - truncation of long symbol names with EQUIVALENCE
For long module names, the generated name-mangled symbol was
truncated, leading to bogus warnings about COMMON block
mismatches. Provide sufficiently large temporaries.
gcc/fortran/
2020-05-24 Harald Anlauf <anlauf@gmx.de>
PR fortran/95106
* trans-common.c (gfc_sym_mangled_common_id): Enlarge temporaries
for name-mangling.
gcc/testsuite/
2020-05-24 Harald Anlauf <anlauf@gmx.de>
PR fortran/95106
* gfortran.dg/equiv_11.f90: New test.
(cherry picked from commit d176184d98a00ab379ae5959aed1908a79995e6b)
Diff:
---
gcc/fortran/trans-common.c | 5 +++--
gcc/testsuite/gfortran.dg/equiv_11.f90 | 12 ++++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 3a9cce6c151..38302f35ef4 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -242,8 +242,9 @@ static tree
gfc_sym_mangled_common_id (gfc_common_head *com)
{
int has_underscore;
- char mangled_name[GFC_MAX_MANGLED_SYMBOL_LEN + 1];
- char name[GFC_MAX_SYMBOL_LEN + 1];
+ /* Provide sufficient space to hold "symbol.eq.1234567890__". */
+ char mangled_name[GFC_MAX_MANGLED_SYMBOL_LEN + 1 + 16];
+ char name[GFC_MAX_SYMBOL_LEN + 1 + 16];
/* Get the name out of the common block pointer. */
strcpy (name, com->name);
diff --git a/gcc/testsuite/gfortran.dg/equiv_11.f90 b/gcc/testsuite/gfortran.dg/equiv_11.f90
new file mode 100644
index 00000000000..0f4a1ab5c32
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/equiv_11.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-fsecond-underscore" }
+! PR fortran/95106
+
+module m2345678901234567890123456789012345678901234567890123456789_123
+ implicit none
+ real :: a(4), u(3,2)
+ real :: b(4), v(4,2)
+ equivalence (a(1),u(1,1)), (b(1),v(1,1))
+end
+! { dg-final { scan-assembler {m2345678901234567890123456789012345678901234567890123456789_123.eq.0__} } }
+! { dg-final { scan-assembler {m2345678901234567890123456789012345678901234567890123456789_123.eq.1__} } }
More information about the Gcc-cvs
mailing list