Commit 2ee8913b by Harald Anlauf

PR fortran/95090 - ICE: identifier overflow

For long module name, derive type and component name, the generated
name-mangled symbol did not fit into a buffer when coarrays were
enabled.  Provide sufficiently large temporary.

2020-05-27  Harald Anlauf  <anlauf@gmx.de>

gcc/fortran/
	PR fortran/95090
	* iresolve.c (gfc_get_string): Enlarge temporary for
	name-mangling.

gcc/testsuite/
	PR fortran/95090
	* gfortran.dg/pr95090.f90: New test.

(cherry picked from commit c949ec9c4e88d2ff6dbd5b179abddf3703129577)
parent 4b3ea558
...@@ -47,7 +47,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -47,7 +47,8 @@ along with GCC; see the file COPYING3. If not see
const char * const char *
gfc_get_string (const char *format, ...) gfc_get_string (const char *format, ...)
{ {
char temp_name[128]; /* Provide sufficient space to hold "_F.caf_token__symbol_MOD_symbol". */
char temp_name[14 + GFC_MAX_SYMBOL_LEN + 5 + GFC_MAX_SYMBOL_LEN + 1];
const char *str; const char *str;
va_list ap; va_list ap;
tree ident; tree ident;
......
! { dg-do compile }
! { dg-options "-fcoarray=lib -fsecond-underscore" }
! PR fortran/95090 - ICE: identifier overflow
module m2345678901234567890123456789012345678901234567890123456789_123
type t2345678901234567890123456789012345678901234567890123456789_123 &
(n2345678901234567890123456789012345678901234567890123456789_123)
integer, len :: n2345678901234567890123456789012345678901234567890123456789_123 = 8
end type
integer :: a2345678901234567890123456789012345678901234567890123456789_123
integer :: b2345678901234567890123456789012345678901234567890123456789_123(3)[*]
data b2345678901234567890123456789012345678901234567890123456789_123 /1,2,3/
contains
subroutine s2345678901234567890123456789012345678901234567890123456789_123
type(t2345678901234567890123456789012345678901234567890123456789_123 &
(n2345678901234567890123456789012345678901234567890123456789_123)) :: &
z2345678901234567890123456789012345678901234567890123456789_123
end
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