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

            Bug ID: 104330
           Summary: ICE in gfc_simplify_image_index, at
                    fortran/simplify.cc:8294
           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 :
(with -fcoarray=single and -fcoarray=lib)


$ cat z1.f90
program p
   type t
   end type
   class(t), allocatable :: x[:]
   allocate (t :: x[*])
   print *, image_index(x, [1])
end


$ cat z2.f90
program p
   class(*), allocatable :: x[:]
   allocate (t :: x[*])
   print *, image_index(x, [1])
end


$ cat z3.f90   # accepted with type
program p
   type t
   end type
   type(t), allocatable :: x[:]
   allocate (t :: x[*])
   print *, image_index(x, [1])
end


$ gfortran-12-20220130 -c z3.f90 -fcoarray=lib
$
$ gfortran-12-20220130 -c z1.f90 -fcoarray=lib
f951: internal compiler error: Segmentation fault
0xcc655f crash_signal
        ../../gcc/toplev.cc:322
0x787eed gfc_simplify_image_index(gfc_expr*, gfc_expr*)
        ../../gcc/fortran/simplify.cc:8294
0x702736 do_simplify
        ../../gcc/fortran/intrinsic.cc:4669
0x70d64a gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.cc:5055
0x7619c8 resolve_unknown_f
        ../../gcc/fortran/resolve.cc:2972
0x7619c8 resolve_function
        ../../gcc/fortran/resolve.cc:3329
0x7619c8 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7169
0x767db4 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7136
0x767db4 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11928
0x76676f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:10944
0x766ac8 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11918
0x769407 resolve_codes
        ../../gcc/fortran/resolve.cc:17537
0x7694ce gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17572
0x7517f4 resolve_all_program_units
        ../../gcc/fortran/parse.cc:6586
0x7517f4 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6842
0x79eecf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:216

Reply via email to