https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65381
--- Comment #5 from G. Steinmetz <gs...@t-online.de> --- Further simplified, z3 without character : $ cat z2.f90 module m type t end type contains pure function g(x) result(z) class(t), intent(in) :: x(:) character :: z(size(x)) end function f(x) type(t), intent(in) :: x(:) character(:), allocatable :: c(:) c(:) = g(x) end end $ cat z3.f90 module m type t end type contains pure function g(x) result(z) class(t), intent(in) :: x(:) integer :: z(size(x)) end function f(x) type(t), intent(in) :: x(:) integer, allocatable :: c(:) c = g(x) end end $ gfortran-9-20181118 -c z3.f90 z3.f90:12:0: 12 | c = g(x) | internal compiler error: Segmentation fault 0xb2a03f crash_signal ../../gcc/toplev.c:325 0x6ea62b gfc_conv_component_ref ../../gcc/fortran/trans-expr.c:2426 0x6f1d2b gfc_conv_variable ../../gcc/fortran/trans-expr.c:2794 0x6eea0a gfc_conv_expr(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:8047 0x6f0fd0 gfc_conv_expr_lhs(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:8077 0x6c77a8 gfc_conv_ss_descriptor ../../gcc/fortran/trans-array.c:2873 0x6d0b74 gfc_conv_expr_descriptor(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-array.c:7118 0x700481 gfc_conv_intrinsic_size ../../gcc/fortran/trans-intrinsic.c:7144 0x715ddb gfc_conv_intrinsic_function(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-intrinsic.c:9754 0x6fa394 gfc_conv_function_expr ../../gcc/fortran/trans-expr.c:6905 0x6ee9ea gfc_conv_expr(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:8039 0x6f0a4a gfc_apply_interface_mapping(gfc_interface_mapping*, gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:4451 0x6c6647 gfc_set_loop_bounds_from_array_spec(gfc_interface_mapping*, gfc_se*, gfc_array_spec*) ../../gcc/fortran/trans-array.c:932 0x6f9795 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*) ../../gcc/fortran/trans-expr.c:6122 0x6fa37c gfc_conv_function_expr ../../gcc/fortran/trans-expr.c:6928 0x6fb0fc gfc_trans_arrayfunc_assign ../../gcc/fortran/trans-expr.c:9462 0x6fea24 gfc_trans_assignment(gfc_expr*, gfc_expr*, bool, bool, bool, bool) ../../gcc/fortran/trans-expr.c:10585 0x6bfe8f trans_code ../../gcc/fortran/trans.c:1822 0x6e7754 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6509 0x6c3c19 gfc_generate_module_code(gfc_namespace*) ../../gcc/fortran/trans.c:2216