https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82969
Bug ID: 82969 Summary: ICE in gfc_class_vptr_get, at fortran/trans-expr.c:211 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- This variant does not compile with snapshot from 20171112 : $ cat z1.f90 module m type t real, allocatable :: x(:) procedure(f), nopass, pointer :: g end type contains function f() result(z) class(t), allocatable :: z end end $ gfortran-8-20171112 -c z1.f90 z1.f90:10:0: end internal compiler error: Segmentation fault 0xb61c7f crash_signal ../../gcc/toplev.c:325 0x75c0de gfc_class_vptr_get(tree_node*) ../../gcc/fortran/trans-expr.c:211 0x75c6c8 class_vtab_field_get ../../gcc/fortran/trans-expr.c:280 0x75c6c8 gfc_class_vtab_size_get(tree_node*) ../../gcc/fortran/trans-expr.c:314 0x741de8 structure_alloc_comps ../../gcc/fortran/trans-array.c:8836 0x75ef9a gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool, bool) ../../gcc/fortran/trans-expr.c:8848 0x76d301 gfc_trans_assignment_1 ../../gcc/fortran/trans-expr.c:10143 0x731de5 trans_code ../../gcc/fortran/trans.c:1843 0x75897c gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6421 0x735841 gfc_generate_module_code(gfc_namespace*) ../../gcc/fortran/trans.c:2206 0x6ea84d translate_all_program_units ../../gcc/fortran/parse.c:6078 0x6ea84d gfc_parse_file() ../../gcc/fortran/parse.c:6294 0x72f13f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204 --- While configured with --enable-checking=yes : $ gfortran-8-20171112-chk -c z1.f90 z1.f90:10:0: end internal compiler error: tree check: expected record_type or union_type or qual_union_type, have function_type in gfc_class_data_get, at fortran/trans-expr.c:188 0x610875 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/tree.c:9098 0x79578b tree_check3(tree_node*, char const*, int, char const*, tree_code, tree_code, tree_code) ../../gcc/tree.h:3128 0x79578b gfc_class_data_get(tree_node*) ../../gcc/fortran/trans-expr.c:188 0x773896 structure_alloc_comps ../../gcc/fortran/trans-array.c:8834 0x799c4a gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool, bool) ../../gcc/fortran/trans-expr.c:8848 0x7ab3a9 gfc_trans_assignment_1 ../../gcc/fortran/trans-expr.c:10143 0x75e3f5 trans_code ../../gcc/fortran/trans.c:1843 0x7913e8 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6421 0x763399 gfc_generate_module_code(gfc_namespace*) ../../gcc/fortran/trans.c:2206 0x715ced translate_all_program_units ../../gcc/fortran/parse.c:6078 0x715ced gfc_parse_file() ../../gcc/fortran/parse.c:6294 0x75b20f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204