https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105633

            Bug ID: 105633
           Summary: ICE in find_array_section, at fortran/expr.cc:1582
           Product: gcc
           Version: 13.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 :
(follow-up of pr105230)


$ cat z1.f90
program p
   integer, parameter :: a(:) = [1,2]
   print *, [a([1,2])]
end


$ cat z2.f90
program p
   integer, parameter :: a(:) = [1,2,2]
   print *, reshape([1,2,3,4], a([3,2]))
end


$ gfortran-13-20220515 -c z1.f90
z1.f90:2:29:

    2 |    integer, parameter :: a(:) = [1,2]
      |                             1
Error: Parameter array 'a' at (1) cannot be automatic or of deferred shape
f951: internal compiler error: Segmentation fault
0xe7b33f crash_signal
        ../../gcc/toplev.cc:322
0x73877d find_array_section
        ../../gcc/fortran/expr.cc:1582
0x739f0a simplify_const_ref
        ../../gcc/fortran/expr.cc:1934
0x73aa3e gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2325
0x73acab simplify_parameter_variable
        ../../gcc/fortran/expr.cc:2154
0x73a9d5 gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2292
0x701228 expand_constructor
        ../../gcc/fortran/array.cc:1827
0x703517 gfc_array_size(gfc_expr*, __mpz_struct (*) [1])
        ../../gcc/fortran/array.cc:2677
0x7a61df expression_shape
        ../../gcc/fortran/resolve.cc:5519
0x7a61df gfc_expression_rank(gfc_expr*)
        ../../gcc/fortran/resolve.cc:5593
0x7a7aaf gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7223
0x7afb9c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7154
0x7afb9c gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11966
0x7ae62f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:10965
0x7ae988 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11956
0x7b1717 resolve_codes
        ../../gcc/fortran/resolve.cc:17602
0x7b17de gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17637
0x799664 resolve_all_program_units
        ../../gcc/fortran/parse.cc:6604
0x799664 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6860
0x7e7eef gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:216

Reply via email to