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

            Bug ID: 95372
           Summary: ICE in find_array_section, at fortran/expr.c:1687
           Product: gcc
           Version: 11.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, works without parameter :


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


$ cat z2.f90
program p
   type t
      integer :: a = 1
   end type
   type(t) :: x(3) = t()
   type(t) :: y(1)
   y = [x(2:2)]
   print *, y
end


$ gfortran-11-20200524 z2.f90 && ./a.out
           1
$
$ gfortran-11-20200524 -c z1.f90
f951: internal compiler error: in find_array_section, at fortran/expr.c:1687
0x655de5 find_array_section
        ../../gcc/fortran/expr.c:1687
0x65735a simplify_const_ref
        ../../gcc/fortran/expr.c:1892
0x657ebe gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.c:2278
0x6580c3 simplify_parameter_variable
        ../../gcc/fortran/expr.c:2107
0x657e8d gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.c:2245
0x6208fd expand_constructor
        ../../gcc/fortran/array.c:1814
0x622c77 gfc_array_size(gfc_expr*, __mpz_struct (*) [1])
        ../../gcc/fortran/array.c:2648
0x6bbfbf expression_shape
        ../../gcc/fortran/resolve.c:5390
0x6bbfbf gfc_expression_rank(gfc_expr*)
        ../../gcc/fortran/resolve.c:5464
0x6bd8bf gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7076
0x6c6144 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:11653
0x6c6144 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11746
0x6c7747 resolve_codes
        ../../gcc/fortran/resolve.c:17257
0x6c780e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17292
0x6af99c resolve_all_program_units
        ../../gcc/fortran/parse.c:6245
0x6af99c gfc_parse_file()
        ../../gcc/fortran/parse.c:6492
0x6fb9af gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210

Reply via email to