https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105379
Bug ID: 105379 Summary: [12 Regression] ICE in gfc_compare_array_spec(): Array spec clobbered Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- Started between 20220417 and 20220424 : $ cat z1.f90 program p type t end type contains subroutine s1(x) class(t) :: x(3) end subroutine s2(n, x) integer :: n class(t) :: x(n) end end $ cat z2.f90 program p type t end type integer :: m = 3 contains subroutine s1(x) class(t) :: x(3) end subroutine s3(x) class(t) :: x(m) end end $ gfortran-12-20220424 -c z1.f90 f951: internal compiler error: gfc_compare_array_spec(): Array spec clobbered 0x6f15b9 gfc_report_diagnostic ../../gcc/fortran/error.cc:883 0x6f3137 gfc_internal_error(char const*, ...) ../../gcc/fortran/error.cc:1503 0x6be47f compare_bounds ../../gcc/fortran/array.cc:971 0x6bfde3 gfc_compare_array_spec(gfc_array_spec*, gfc_array_spec*) ../../gcc/fortran/array.cc:1012 0x6ff3dc compare_components ../../gcc/fortran/interface.cc:495 0x6ff6d0 gfc_compare_derived_types(gfc_symbol*, gfc_symbol*) ../../gcc/fortran/interface.cc:678 0x834de8 gfc_copy_dt_decls_ifequal(gfc_symbol*, gfc_symbol*, bool) ../../gcc/fortran/trans-types.cc:2453 0x8342c4 gfc_get_derived_type(gfc_symbol*, int) ../../gcc/fortran/trans-types.cc:2922 0x834d18 gfc_typenode_for_spec(gfc_typespec*, int) ../../gcc/fortran/trans-types.cc:1195 0x834f78 gfc_sym_type(gfc_symbol*, bool) ../../gcc/fortran/trans-types.cc:2307 0x83344f gfc_get_function_type(gfc_symbol*, gfc_actual_arglist*, char const*) ../../gcc/fortran/trans-types.cc:3161 0x7c7424 build_function_decl ../../gcc/fortran/trans-decl.cc:2393 0x7cf3a6 gfc_create_function_decl(gfc_namespace*, bool) ../../gcc/fortran/trans-decl.cc:3102 0x7d48be gfc_generate_contained_functions ../../gcc/fortran/trans-decl.cc:5768 0x7d48be gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.cc:7586 0x75700e translate_all_program_units ../../gcc/fortran/parse.cc:6669 0x75700e gfc_parse_file() ../../gcc/fortran/parse.cc:6956 0x7a44af gfc_be_parse_file ../../gcc/fortran/f95-lang.cc:216