From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9966 invoked by alias); 29 May 2013 17:16:34 -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 9918 invoked by uid 48); 29 May 2013 17:16:30 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/57456] New: [OOP] CLASS ALLOCATE with typespec: Too little memory allocated Date: Wed, 29 May 2013 17:16: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-Version: 4.9.0 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-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-05/txt/msg02049.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57456 Bug ID: 57456 Summary: [OOP] CLASS ALLOCATE with typespec: Too little memory allocated Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org The following seems to ignore the typespec ("t2::") when calculating how much memory is required to allocate: module m implicit none type t integer :: i end type t type, extends(t) :: t2 integer :: j end type t2 end module m program test use m implicit none integer :: i class(t), save, allocatable :: y(:) allocate (t2 :: y(5)) ! Should malloc 2*4*5 = 40 bytes, mallocs only 20 select type(y) type is (t2) do i = 1, 5 y(i)%i = i ! "Invalid write of size 4" end do end select deallocate(y) ! SIGABRT: Process abort signal. end