http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58880

            Bug ID: 58880
           Summary: ICE on valid with FINAL function and type extension
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gmail dot com

The following causes an ICE using gfortran 4.9.0 (r204039):

module gn
  type sl
     integer, allocatable, dimension(:) :: lv
   contains
     final :: sld
  end type sl
  type :: nde
     type(sl) :: r
  end type nde
contains
  subroutine ndm(s)
    type(nde), intent(inout) :: s
    type(nde)                :: i    
    i=s
  end subroutine ndm
  subroutine sld(s)
    implicit none
    type(sl), intent(inout) :: s
    return
  end subroutine sld
end module gn

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/abenson/Galacticus/Tools
--enable-languages=c,c++,fortran --disable-multilib
--with-gmp=/home/abenson/Galacticus/Tools
Thread model: posix
gcc version 4.9.0 20131024 (experimental) (GCC) 

$ gfortran -c tmp1.F90 -o tmp1.o
tmp1.F90: In function 'ndm':
tmp1.F90:14:0: internal compiler error: in fold_convert_loc, at
fold-const.c:1970
     i=s
 ^
0x78774d fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ../../gcc-trunk/gcc/fold-const.c:1969
0x59d0c8 gfc_conv_descriptor_data_set(stmtblock_t*, tree_node*, tree_node*)
        ../../gcc-trunk/gcc/fortran/trans-array.c:178
0x5c4be8 gfc_conv_scalar_to_descriptor(gfc_se*, tree_node*, symbol_attribute)
        ../../gcc-trunk/gcc/fortran/trans-expr.c:72
0x599421 gfc_add_comp_finalizer_call(stmtblock_t*, tree_node*, gfc_component*,
bool)
        ../../gcc-trunk/gcc/fortran/trans.c:1011
0x5a7689 structure_alloc_comps
        ../../gcc-trunk/gcc/fortran/trans-array.c:7609
0x5c863b gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool,
bool)
        ../../gcc-trunk/gcc/fortran/trans-expr.c:6946
0x5d35a2 gfc_trans_assignment_1
        ../../gcc-trunk/gcc/fortran/trans-expr.c:7990
0x598f11 trans_code
        ../../gcc-trunk/gcc/fortran/trans.c:1622
0x5c1b5e gfc_generate_function_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans-decl.c:5528
0x59a6e1 gfc_generate_module_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans.c:1955
0x5583df translate_all_program_units
        ../../gcc-trunk/gcc/fortran/parse.c:4496
0x5583df gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:4706
0x594955 gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:189
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Removing any of:

     integer, allocatable, dimension(:) :: lv
     final :: sld
     i=s

results in a successful compile.

Reply via email to