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

G. Steinmetz <gs...@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |ice-on-valid-code

--- Comment #3 from G. Steinmetz <gs...@t-online.de> ---

Regarding these variants, all of them actually work :


$ cat zc1.f90
program p
   type t
      integer, allocatable :: c
   end type
   type(t) :: x
   integer :: n = storage_size(x)
   print *, n
end


$ cat zc2.f90
program p
   type t
      logical, allocatable :: c
   end type
   type(t) :: x
   integer :: n = storage_size(x)
   print *, n
end


$ cat zc3.f90
program p
   type t
      real, allocatable :: c
   end type
   type(t) :: x
   integer :: n = storage_size(x)
   print *, n
end


$ cat zc4.f90
program p
   type t
      character, allocatable :: c
   end type
   type(t) :: x
   integer :: n = storage_size(x)
   print *, n
end


$ cat zc5.f90
program p
   type t
      class(*), allocatable :: c
   end type
   type(t) :: x
   integer :: n = storage_size(x)
   print *, n
end


$ gfortran-13-20220619 zc1.f90 ; a.out
          64
$ gfortran-13-20220619 zc2.f90 ; a.out
          64
$ gfortran-13-20220619 zc3.f90 ; a.out
          64
$ gfortran-13-20220619 zc4.f90 ; a.out
          64
$ gfortran-13-20220619 zc5.f90 ; a.out
         192

---

Testing additional options, there is never an ICE with zc5.f90,
but with the other ones e.g. at line 9129 instead of line 9574 :


$ gfortran-13-20220619 -c zc1.f90 -fcoarray=single
zc1.f90:5:15:

    5 |    type(t) :: x
      |               1
internal compiler error: Segmentation fault
0xcd90df crash_signal
        ../../gcc/toplev.cc:322
0x7c4366 structure_alloc_comps
        ../../gcc/fortran/trans-array.cc:9129
0x7c7348 gfc_nullify_alloc_comp(gfc_symbol*, tree_node*, int, int)
        ../../gcc/fortran/trans-array.cc:10149
0x7c7348 gfc_trans_deferred_array(gfc_symbol*, gfc_wrapped_block*)
        ../../gcc/fortran/trans-array.cc:11206
0x7dabac gfc_trans_deferred_vars(gfc_symbol*, gfc_wrapped_block*)
        ../../gcc/fortran/trans-decl.cc:4994
0x7dd1a5 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:7756
0x75f53e translate_all_program_units
        ../../gcc/fortran/parse.cc:6669
0x75f53e gfc_parse_file()
        ../../gcc/fortran/parse.cc:6956
0x7acb6f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

Reply via email to