char use_assoc, saved, threadprivate;
unsigned char omp_declare_target : 1;
unsigned char omp_declare_target_link : 1;
- /* Provide sufficient space to hold "symbol.eq.1234567890". */
- char name[GFC_MAX_SYMBOL_LEN + 1 + 14];
+ /* Provide sufficient space to hold "symbol.symbol.eq.1234567890". */
+ char name[2*GFC_MAX_SYMBOL_LEN + 1 + 14 + 1];
struct gfc_symbol *head;
const char* binding_label;
int is_bind_c;
gfc_sym_mangled_common_id (gfc_common_head *com)
{
int has_underscore;
- /* 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];
+ /* Provide sufficient space to hold "symbol.symbol.eq.1234567890__". */
+ char mangled_name[2*GFC_MAX_MANGLED_SYMBOL_LEN + 1 + 16 + 1];
+ char name[sizeof (mangled_name) - 2];
/* Get the name out of the common block pointer. */
+ size_t len = strlen (com->name);
+ gcc_assert (len < sizeof (name));
strcpy (name, com->name);
/* If we're suppose to do a bind(c). */
--- /dev/null
+! { dg-do compile }
+! { dg-options "-fsecond-underscore" }
+! PR fortran/95707 - ICE in finish_equivalences, at fortran/trans-common.c:1319
+
+module m2345678901234567890123456789012345678901234567890123456789_123
+ interface
+ module subroutine s2345678901234567890123456789012345678901234567890123456789_123
+ end
+ end interface
+end
+submodule(m2345678901234567890123456789012345678901234567890123456789_123) &
+ n2345678901234567890123456789012345678901234567890123456789_123
+ real :: a(4), u(3,2)
+ real :: b(4), v(4,2)
+ equivalence (a(1),u(1,1)), (b(1),v(1,1))
+end