PR fortran/95828 - Buffer overflows with SELECT RANK
With SELECT RANK, name mangling results in long internal symbols that overflows internal buffers. Fix that. gcc/fortran/ PR fortran/95828 * match.c (select_rank_set_tmp): Enlarge internal buffer used in generating a mangled name. * resolve.c (resolve_select_rank): Likewise.
This commit is contained in:
parent
35a335a159
commit
77d455ee81
@ -6496,7 +6496,7 @@ static void
|
||||
select_rank_set_tmp (gfc_typespec *ts, int *case_value)
|
||||
{
|
||||
char name[2 * GFC_MAX_SYMBOL_LEN];
|
||||
char tname[GFC_MAX_SYMBOL_LEN];
|
||||
char tname[GFC_MAX_SYMBOL_LEN + 7];
|
||||
gfc_symtree *tmp;
|
||||
gfc_symbol *selector = select_type_stack->selector;
|
||||
gfc_symbol *sym;
|
||||
|
@ -9635,7 +9635,7 @@ resolve_select_rank (gfc_code *code, gfc_namespace *old_ns)
|
||||
gfc_namespace *ns;
|
||||
gfc_code *body, *new_st, *tail;
|
||||
gfc_case *c;
|
||||
char tname[GFC_MAX_SYMBOL_LEN];
|
||||
char tname[GFC_MAX_SYMBOL_LEN + 7];
|
||||
char name[2 * GFC_MAX_SYMBOL_LEN];
|
||||
gfc_symtree *st;
|
||||
gfc_expr *selector_expr = NULL;
|
||||
|
21
gcc/testsuite/gfortran.dg/pr95828.f90
Normal file
21
gcc/testsuite/gfortran.dg/pr95828.f90
Normal file
@ -0,0 +1,21 @@
|
||||
! { dg-do compile }
|
||||
! { dg-options "-fsecond-underscore" }
|
||||
! PR fortran/95828 - ICE in resolve_select_rank, at fortran/resolve.c:9774
|
||||
|
||||
module m2345678901234567890123456789012345678901234567890123456789_123
|
||||
type t2345678901234567890123456789012345678901234567890123456789_123
|
||||
end type
|
||||
contains
|
||||
subroutine s2345678901234567890123456789012345678901234567890123456789_123 &
|
||||
(x2345678901234567890123456789012345678901234567890123456789_123)
|
||||
type (t2345678901234567890123456789012345678901234567890123456789_123) :: &
|
||||
x2345678901234567890123456789012345678901234567890123456789_123(..)
|
||||
|
||||
select rank (y2345678901234567890123456789012345678901234567890123456789_123 &
|
||||
=> x2345678901234567890123456789012345678901234567890123456789_123)
|
||||
rank (2)
|
||||
rank (3)
|
||||
rank default
|
||||
end select
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user