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



             Bug #: 56845

           Summary: [OOP] _vptr not set to declared type for CLASS + SAVE

    Classification: Unclassified

           Product: gcc

           Version: 4.9.0

            Status: UNCONFIRMED

          Keywords: wrong-code

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: bur...@gcc.gnu.org

                CC: ja...@gcc.gnu.org





The program below fails at run time. Unallocated the class should match the

declared type - but it is never set with SAVE.





The dump of the following program shows:

  static struct __class_m_T_a y = {};

Expected:

  static struct __class_m_T_a y = { ._data = 0B, ._vptr = &__vtab_m_T};





module m

type t

integer ::a

end type t

contains

subroutine sub

  type(t), save, allocatable :: x

  class(t), save,allocatable :: y

  if (.not. same_type_as(x,y)) call abort()

end subroutine sub

subroutine sub2

  type(t), save, allocatable :: a(:)

  class(t), save,allocatable :: b(:)

  if (.not. same_type_as(a,b)) call abort()

end subroutine sub2

end module m



use m

call sub()

call sub2()

end

Reply via email to