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

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

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

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

Update, reduced a bit :


$ cat z1.f90
module m
   type t
      class(*), pointer :: z => null()
   end type
end
program p
contains
   subroutine s1
      use m
      type(t) :: x
      call s2(x)
   end
   subroutine s2(x)
      use m
      type(t) :: x
   end
end


$ gfortran-9-20181104 -c z1.f90
z1.f90:12:0:

   12 |    end
      |
internal compiler error: Segmentation fault
0xb205df crash_signal
        ../../gcc/toplev.c:325
0x6f3735 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
        ../../gcc/fortran/trans-expr.c:7814
0x6f3282 gfc_trans_subcomponent_assign
        ../../gcc/fortran/trans-expr.c:7659
0x6f375a gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
        ../../gcc/fortran/trans-expr.c:7824
0x6edf0f gfc_conv_structure(gfc_se*, gfc_expr*, int)
        ../../gcc/fortran/trans-expr.c:7891
0x6ee14c gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:8059
0x6fc779 gfc_trans_assignment_1
        ../../gcc/fortran/trans-expr.c:10248
0x6dd90d gfc_init_default_dt(gfc_symbol*, stmtblock_t*, bool)
        ../../gcc/fortran/trans-decl.c:4067
0x6e4f30 gfc_trans_deferred_vars(gfc_symbol*, gfc_wrapped_block*)
        ../../gcc/fortran/trans-decl.c:4792
0x6e6ef8 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6614
0x6e6c14 gfc_generate_contained_functions
        ../../gcc/fortran/trans-decl.c:5524
0x6e6c14 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6441
0x6740a6 translate_all_program_units
        ../../gcc/fortran/parse.c:6125
0x6740a6 gfc_parse_file()
        ../../gcc/fortran/parse.c:6328
0x6bc03f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:204


---

The ICE also goes away when all "use m" are moved to top level :

$ cat z7.f90
module m
   type t
      class(*), pointer :: z => null()
   end type
end
program p
   use m
   call s1
contains
   subroutine s1
      type(t) :: x
      call s2(x)
   end
   subroutine s2(x)
      type(t) :: x
   end
end

Reply via email to