From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11702 invoked by alias); 4 Apr 2013 19:08:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 11650 invoked by uid 48); 4 Apr 2013 19:08:35 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/56845] New: [OOP] _vptr not set to declared type for CLASS + SAVE Date: Thu, 04 Apr 2013 19:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg00449.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org CC: janus@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