https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85001
Bug ID: 85001 Summary: [6/7/8 Regression] ICE in gfc_build_array_type, at fortran/trans-types.c:1420 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: --- gfortran-8 changed between 20171105 and 20171112. gfortran-7 changed between 20180111 and 20180125. gfortran-6 changed between 20180110 and 20180207. $ cat z1.f90 program p type t end type call s contains real function f(x) class(t) :: x dimension :: x(:) f = 1.0 end subroutine s type(t) :: x(2) real :: z z = f(x) end end The error message was formerly a bit misleading : $ gfortran-8-20171105 -c z1.f90 z1.f90:14:12: z = f(x) 1 Error: Rank mismatch in argument 'x' at (1) (scalar and rank-1) $ gfortran-8-20180318 -c z1.f90 z1.f90:6:0: real function f(x) internal compiler error: Segmentation fault 0xb9bd5f crash_signal ../../gcc/toplev.c:325 0x7c0de7 gfc_build_array_type ../../gcc/fortran/trans-types.c:1420 0x7c264f gfc_get_derived_type(gfc_symbol*, int) ../../gcc/fortran/trans-types.c:2768 0x7c2f28 gfc_typenode_for_spec(gfc_typespec*, int) ../../gcc/fortran/trans-types.c:1203 0x7c31b4 gfc_sym_type(gfc_symbol*) ../../gcc/fortran/trans-types.c:2267 0x7c19a4 gfc_get_function_type(gfc_symbol*) ../../gcc/fortran/trans-types.c:3067 0x766a9f build_function_decl ../../gcc/fortran/trans-decl.c:2233 0x768506 gfc_create_function_decl(gfc_namespace*, bool) ../../gcc/fortran/trans-decl.c:2909 0x771529 gfc_generate_contained_functions ../../gcc/fortran/trans-decl.c:5510 0x771529 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6436 0x7009c0 translate_all_program_units ../../gcc/fortran/parse.c:6121 0x7009c0 gfc_parse_file() ../../gcc/fortran/parse.c:6324 0x74755f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204