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

            Bug ID: 59765
           Summary: ICE on valid with allocatable component 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 with gfortran 4.9.0 r206484, but compiles
successfully with r205975:

module mtds
  type umd
     integer, dimension(:), allocatable :: c
  end type umd
  type mtd
     type(umd), dimension(1) :: u
  end type mtd
contains
  subroutine add(s)
    class(mtd), intent(inout) :: s
  end subroutine add
end module mtds


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

$ gfortran -c tmp1.F90 -o tmp1.o 
tmp1.F90: In function ‘__final_mtds_Mtd’:
tmp1.F90:10:0: internal compiler error: in gfc_conv_descriptor_data_get, at
fortran/trans-array.c:145
     class(mtd), intent(inout) :: s
 ^
0x65cd8d gfc_conv_descriptor_data_get(tree_node*)
        ../../trunk/gcc/fortran/trans-array.c:145
0x66454f gfc_array_deallocate(tree_node*, tree_node*, tree_node*, tree_node*,
tree_node*, gfc_expr*)
        ../../trunk/gcc/fortran/trans-array.c:5335
0x6bedfd gfc_trans_deallocate(gfc_code*)
        ../../trunk/gcc/fortran/trans-stmt.c:5421
0x658c27 trans_code
        ../../trunk/gcc/fortran/trans.c:1782
0x6bc344 gfc_trans_simple_do
        ../../trunk/gcc/fortran/trans-stmt.c:1427
0x6bc344 gfc_trans_do(gfc_code*, tree_node*)
        ../../trunk/gcc/fortran/trans-stmt.c:1590
0x658cea trans_code
        ../../trunk/gcc/fortran/trans.c:1732
0x6827be gfc_generate_function_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.c:5605
0x65a6c1 gfc_generate_module_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans.c:1956
0x61689d translate_all_program_units
        ../../trunk/gcc/fortran/parse.c:4523
0x61689d gfc_parse_file()
        ../../trunk/gcc/fortran/parse.c:4733
0x654815 gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.c:188
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.


The ICE goes away if I do any of the following:

* Change "class(mtd)" to "type(mtd)"

* Make the "u" component of "mtd" allocatable, or make it a scalar

* Make the "c" component of "umd" non-allocatable

Reply via email to