https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79440
--- Comment #4 from G. Steinmetz <gs...@t-online.de> --- Reduced test case from comment 0 : $ cat z3.f90 module m type t end type type t2 class(t), pointer :: a end type type, extends(t2) :: t3 end type type t4 class(t2), pointer :: b end type end program p use m type(t), target, allocatable :: y type(t4), allocatable :: z allocate (z%b, source=t3(y)) end $ cat z4.f90 program p type t end type type t2 class(t), pointer :: a end type type, extends(t2) :: t3 end type type t4 class(t2), pointer :: b end type type(t), target, allocatable :: y type(t4), allocatable :: z allocate (z%b, source=t3(y)) end $ gfortran-9-20181111 -c z4.f90 z4.f90:14:0: 14 | allocate (z%b, source=t3(y)) | internal compiler error: in fold_convert_loc, at fold-const.c:2548 0x95f280 fold_convert_loc(unsigned int, tree_node*, tree_node*) ../../gcc/fold-const.c:2548 0x731cfc gfc_trans_subcomponent_assign ../../gcc/fortran/trans-expr.c:7642 0x732da8 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool) ../../gcc/fortran/trans-expr.c:7824 0x732462 gfc_trans_subcomponent_assign ../../gcc/fortran/trans-expr.c:7659 0x732da8 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool) ../../gcc/fortran/trans-expr.c:7824 0x733daa gfc_conv_structure(gfc_se*, gfc_expr*, int) ../../gcc/fortran/trans-expr.c:7891 0x72bc9c gfc_conv_expr(gfc_se*, gfc_expr*) ../../gcc/fortran/trans-expr.c:8059 0x7340e5 gfc_conv_expr_reference(gfc_se*, gfc_expr*, bool) ../../gcc/fortran/trans-expr.c:8184 0x77e95c gfc_trans_allocate(gfc_code*) ../../gcc/fortran/trans-stmt.c:5927 0x6e67a7 trans_code ../../gcc/fortran/trans.c:1990 0x71be1d gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6509 0x699c56 translate_all_program_units ../../gcc/fortran/parse.c:6125 0x699c56 gfc_parse_file() ../../gcc/fortran/parse.c:6328 0x6e2b7f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204