Commit 69240fb9 by Harald Anlauf

PR fortran/95827 - Buffer overflows with submodules and coarrays

With submodules and coarrays, name mangling results in long internal
symbols.  Enlarge internal buffer.

gcc/fortran/
	PR fortran/95827
	* iresolve.c (gfc_get_string): Enlarge internal buffer used in
	generating the mangled name.

(cherry picked from commit a16d0924f18046704ef9a4b6d9593718594677f1)
parent d9b3aa51
......@@ -47,8 +47,8 @@ along with GCC; see the file COPYING3. If not see
const char *
gfc_get_string (const char *format, ...)
{
/* Provide sufficient space to hold "_F.symbol.symbol_MOD_symbol". */
char temp_name[4 + 2*GFC_MAX_SYMBOL_LEN + 5 + GFC_MAX_SYMBOL_LEN + 1];
/* Provide sufficient space for "_F.caf_token__symbol.symbol_MOD_symbol". */
char temp_name[15 + 2*GFC_MAX_SYMBOL_LEN + 5 + GFC_MAX_SYMBOL_LEN + 1];
const char *str;
va_list ap;
tree ident;
......
! { dg-do compile }
! { dg-options "-fcoarray=lib -fsecond-underscore" }
! PR fortran/95827 - ICE in gfc_get_string, at fortran/iresolve.c:70
module m2345678901234567890123456789012345678901234567890123456789_123
interface
module subroutine s2345678901234567890123456789012345678901234567890123456789_123
end
end interface
end
submodule(m2345678901234567890123456789012345678901234567890123456789_123) &
n2345678901234567890123456789012345678901234567890123456789_123
integer :: x2345678901234567890123456789012345678901234567890123456789_123[*]
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment