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;
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;
--- /dev/null
+! { 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