http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57710
Bug ID: 57710
Summary: [OOP] _vptr not set for allocatable CLASS components
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code, wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
The following code (minus the IF condition) shows that _vptr is not set for the
allocatable component:
y.x._data = 0B;
there should be - but isn't - additionally: y.x._vptr = &__vtab_m_T;
Additionally, the test case as is (with IF condition), currently crashes with:
internal compiler error: in gfc_conv_component_ref, at
fortran/trans-expr.c:1654
if (.not. same_type_as(y%x, z)) call abort ()
^
0x632ce2 gfc_conv_component_ref
../../gcc/fortran/trans-expr.c:1654
0x63fc89 gfc_conv_variable
../../gcc/fortran/trans-expr.c:1921
module m
type t
end type t
type t2
integer :: ii
class(t), allocatable :: x
end type t2
contains
subroutine fini(x)
type(t) :: x
end subroutine fini
end module m
use m
block
type(t) :: z
type(t2) :: y
y%ii = 123
if (.not. same_type_as(y%x, z)) call abort ()
end block
end