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

            Bug ID: 57535
           Summary: [OOP] ICE when allocating a CLASS function-result
                    variable
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: janus at gcc dot gnu.org

The following program fails with an ICE (with GCC 4.5 to 4.9):

test.f90: In function 'func2':
test.f90:13:0: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have function_type in gfc_class_vptr_get, at
fortran/trans-expr.c:137
     allocate(func2(3))
 ^
0xba654a tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:9061
0x6332dc tree_check3
        ../../gcc/tree.h:3735
0x6332dc gfc_class_vptr_get(tree_node*)
        ../../gcc/fortran/trans-expr.c:137
0x6333cc gfc_vtable_field_get
        ../../gcc/fortran/trans-expr.c:150



program test
  implicit none
  type t
    integer :: ii = 55
  end type t
contains
  function func2()
    class(t), allocatable :: func2(:)
    allocate(func2(3))
    func2%ii = [111,222,333]
  end function func2
end program test

Reply via email to