https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116292
--- Comment #5 from anlauf at gcc dot gnu.org ---
Breakpoint 1, build_function_decl (sym=0x3316310, global=global@entry=false)
at ../../gcc-trunk/gcc/fortran/trans-decl.cc:2486
2486 gcc_assert (current_function_decl == NULL_TREE
(gdb) l
2481 /* Set the line and filename. sym->declared_at seems to point to the
2482 last statement for subroutines, but it'll do for now. */
2483 gfc_set_backend_locus (&sym->declared_at);
2484
2485 /* Allow only one nesting level. Allow public declarations. */
2486 gcc_assert (current_function_decl == NULL_TREE
2487 || DECL_FILE_SCOPE_P (current_function_decl)
2488 || (TREE_CODE (DECL_CONTEXT (current_function_decl))
2489 == NAMESPACE_DECL));
2490
The ICE comes after:
(gdb) p debug_tree(current_function_decl)
<function_decl 0x7ffff6c07800 s
type <function_type 0x7ffff6c06930
type <void_type 0x7ffff6a25f18 void VOID
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6a25f18
pointer_to_this <pointer_type 0x7ffff6a2d000>>
QI
size <integer_cst 0x7ffff6a0beb8 constant 8>
unit-size <integer_cst 0x7ffff6a0bed0 constant 1>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6a327e0
attributes <tree_list 0x7ffff6809618
purpose <identifier_node 0x7ffff6be1dc0 fn spec>
value <tree_list 0x7ffff68095f0
value <string_cst 0x7ffff6bf1ba0 constant ". ">>>
arg-types <tree_list 0x7ffff6a24de8 value <void_type 0x7ffff6a25f18
void>>>
static QI pr116292.f90:4:14 align:8 warn_if_not_align:0 context
<function_decl 0x7ffff6c07600 p>
result <result_decl 0x7ffff6a15258 D.4271 type <void_type 0x7ffff6a25f18
void>
ignored VOID pr116292.f90:4:14
align:8 warn_if_not_align:0 context <function_decl 0x7ffff6c07800 s>>
(mem:QI (symbol_ref:DI ("s.0") [flags 0x3] <function_decl 0x7ffff6c07800
s>) [0 S1 A8])
struct-function 0x7ffff680a0c0>