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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gs...@t-online.de

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

Update :


$ cat z1.f90
program p
   select type (y => f())
   end select
contains
   function f()
      class(*), pointer :: f(:)
   end
end


$ cat z2.f90
program p
   select type (y => f())
   end select
contains
   function f()
      class(*), allocatable :: f(:)
   end
end


$ gfortran-10-20191208 -c z2.f90
f951: internal compiler error: Segmentation fault
0xb800af crash_signal
        ../../gcc/toplev.c:328
0x6a7c28 resolve_select_type
        ../../gcc/fortran/resolve.c:9158
0x698564 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11897
0x69a0d7 resolve_codes
        ../../gcc/fortran/resolve.c:17186
0x69a19e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17221
0x68859c resolve_all_program_units
        ../../gcc/fortran/parse.c:6241
0x68859c gfc_parse_file()
        ../../gcc/fortran/parse.c:6488
0x6d306f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210


---


Similar with associate :


$ cat z4.f90
program p
   associate (y => f())
   end associate
contains
   function f()
      class(*), pointer :: f(:)
   end
end


$ cat z5.f90
program p
   associate (y => f())
   end associate
contains
   function f()
      class(*), allocatable :: f(:)
   end
end


$ gfortran-10-20191208 -c z5.f90
z5.f90:2:0:

    2 |    associate (y => f())
      |
internal compiler error: Segmentation fault
0xd05dff crash_signal
        ../../gcc/toplev.c:328
0x744fbc gfc_class_data_get(tree_node*)
        ../../gcc/fortran/trans-expr.c:189
0x7a03fd trans_associate_var
        ../../gcc/fortran/trans-stmt.c:2015
0x7a6099 gfc_trans_block_construct(gfc_code*)
        ../../gcc/fortran/trans-stmt.c:2283
0x709cd7 trans_code
        ../../gcc/fortran/trans.c:1960
0x74107d gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6801
0x6bafe6 translate_all_program_units
        ../../gcc/fortran/parse.c:6302
0x6bafe6 gfc_parse_file()
        ../../gcc/fortran/parse.c:6541
0x705fcf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210


---


And finally, above four variants do compile with scalar items, e.g. :


$ cat za1.f90
program p
   select type (y => f())
   end select
contains
   function f()
      class(*), pointer :: f
   end
end


$ gfortran-10-20191208 -c za1.f90
$

Reply via email to