https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83865
--- Comment #1 from G. Steinmetz <gs...@t-online.de> --- A similar pair : ICE with 7/8 for z4.f90, z5.f90 works. $ cat z4.f90 program p associate (x => f()) if ( x(1) /= '' ) call abort end associate contains function f() result(z) character(:), allocatable :: z(:) allocate (z, source=['']) end end $ cat z5.f90 program p associate (x => f()) if ( x(1) /= 'a' ) call abort end associate contains function f() result(z) character(:), allocatable :: z(:) allocate (z, source=['a']) end end $ gfortran-8-20180114 -c z4.f90 z4.f90:8:0: allocate (z, source=['']) internal compiler error: in wide_int_to_tree_1, at tree.c:1567 0xdd23c3 wide_int_to_tree_1 ../../gcc/tree.c:1567 0xdd293b wide_int_to_tree(tree_node*, poly_int<1u, generic_wide_int<wide_int_ref_storage<false, true> > > const&) ../../gcc/tree.c:1692 0xdd293b build_int_cst(tree_node*, poly_int<1u, long>) ../../gcc/tree.c:1360 0x7494ae gfc_allocate_allocatable(stmtblock_t*, tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, gfc_expr*, int) ../../gcc/fortran/trans.c:801 0x7b604d gfc_trans_allocate(gfc_code*) ../../gcc/fortran/trans-stmt.c:6268 0x747a27 trans_code ../../gcc/fortran/trans.c:1980 0x76eb79 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6451 0x76e9f7 gfc_generate_contained_functions ../../gcc/fortran/trans-decl.c:5463 0x76e9f7 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6380 0x6fe980 translate_all_program_units ../../gcc/fortran/parse.c:6103 0x6fe980 gfc_parse_file() ../../gcc/fortran/parse.c:6306 0x744e5f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204