https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103588
Bug ID: 103588 Summary: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 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: --- Affects versions down to at least r5 : (z1/z2 derived from a valid z0.f90) $ cat z1.f90 program p integer, parameter :: a(:) = [1, 2] integer :: b(2) = a(::a(1)) end $ cat z2.f90 program p integer, parameter :: a(:) = [1, 2] integer :: b(2) = a(1:2:a(1)) end $ cat z0.f90 program p integer, parameter :: a(*) = [1, 2] integer :: b(2) = a(::a(1)) print *, b end $ gfortran-12-20211205 -c z1.f90 f951: internal compiler error: Simplification error 0x799179 gfc_report_diagnostic ../../gcc/fortran/error.c:874 0x79ace7 gfc_internal_error(char const*, ...) ../../gcc/fortran/error.c:1494 0x768be0 gfc_ref_dimen_size(gfc_array_ref*, int, __mpz_struct (*) [1], __mpz_struct (*) [1]) ../../gcc/fortran/array.c:2407 0x80a6bf expression_shape ../../gcc/fortran/resolve.c:5501 0x80a6bf gfc_expression_rank(gfc_expr*) ../../gcc/fortran/resolve.c:5575 0x80c76b resolve_variable ../../gcc/fortran/resolve.c:6004 0x80c76b gfc_resolve_expr(gfc_expr*) ../../gcc/fortran/resolve.c:7168 0x79f054 gfc_reduce_init_expr(gfc_expr*) ../../gcc/fortran/expr.c:3155 0x7a1fc0 gfc_match_init_expr(gfc_expr**) ../../gcc/fortran/expr.c:3203 0x78c3d4 variable_decl ../../gcc/fortran/decl.c:3004 0x78c3d4 gfc_match_data_decl() ../../gcc/fortran/decl.c:6297 0x7f6343 match_word ../../gcc/fortran/parse.c:67 0x7f6343 decode_statement ../../gcc/fortran/parse.c:378 0x7f7d8a next_free ../../gcc/fortran/parse.c:1397 0x7f7d8a next_statement ../../gcc/fortran/parse.c:1629 0x7f931b parse_spec ../../gcc/fortran/parse.c:4168 0x7fc46c parse_progunit ../../gcc/fortran/parse.c:6192 0x7fdb31 gfc_parse_file() ../../gcc/fortran/parse.c:6737 0x84afaf gfc_be_parse_file ../../gcc/fortran/f95-lang.c:216