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

            Bug ID: 105954
           Summary: ICE in gfc_element_size, at
                    fortran/target-memory.cc:132
           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 :


$ cat z1.f90
program p
   type t
      real :: a(3,2:-1)
   end type
   type t2
      type(t) :: b(2)
   end type
   type(t2) :: c
   integer, parameter :: n = sizeof(c%b)
end


$ cat z2.f90
program p
   type t
      real :: a(3,2:0)
   end type
   type t2
      type(t) :: b(2)
   end type
   type(t2) :: c
   integer :: n = sizeof(c%b)
end


$ cat z3.f90
program p
   type t
      real :: a(3,2:-1)
   end type
   type t2
      type(t) :: b
   end type
   type(t2) :: c
   integer, parameter :: n = sizeof(c%b)
end


$ gfortran-13-20220612 -c z1.f90
f951: internal compiler error: in gfc_element_size, at
fortran/target-memory.cc:132
0x79f574 gfc_element_size(gfc_expr*, unsigned long*)
        ../../gcc/fortran/target-memory.cc:132
0x79f5b3 gfc_target_expr_size(gfc_expr*, unsigned long*)
        ../../gcc/fortran/target-memory.cc:165
0x79340b gfc_simplify_sizeof(gfc_expr*)
        ../../gcc/fortran/simplify.cc:7637
0x70e392 do_simplify
        ../../gcc/fortran/intrinsic.cc:4663
0x7192da gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.cc:5056
0x76de18 resolve_unknown_f
        ../../gcc/fortran/resolve.cc:2990
0x76de18 resolve_function
        ../../gcc/fortran/resolve.cc:3347
0x76de18 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7187
0x6fe2b4 gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.cc:3163
0x701240 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.cc:3211
0x6eb584 variable_decl
        ../../gcc/fortran/decl.cc:3004
0x6eb584 gfc_match_data_decl()
        ../../gcc/fortran/decl.cc:6299
0x756333 match_word
        ../../gcc/fortran/parse.cc:67
0x756333 decode_statement
        ../../gcc/fortran/parse.cc:378
0x757d7a next_free
        ../../gcc/fortran/parse.cc:1397
0x757d7a next_statement
        ../../gcc/fortran/parse.cc:1629
0x75930b parse_spec
        ../../gcc/fortran/parse.cc:4168
0x75c4ac parse_progunit
        ../../gcc/fortran/parse.cc:6210
0x75db71 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6755
0x7ab8cf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

Reply via email to