From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2046 invoked by alias); 13 Mar 2013 14:18:48 -0000 Received: (qmail 1789 invoked by uid 48); 13 Mar 2013 14:17:46 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/56596] Invalid read of size 4 gfortran.dg/class_array_7.f03 Date: Wed, 13 Mar 2013 14:18:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: janus 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: Keywords CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-03/txt/msg01043.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56596 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |janus at gcc dot gnu.org --- Comment #1 from janus at gcc dot gnu.org 2013-03-13 14:17:40 UTC --- Reduced test case: program main implicit none type :: base_type integer :: i end type type, extends(base_type) :: extended_type integer :: j end type class(base_type), dimension(:), allocatable :: a type(extended_type), dimension(1:2) :: tmp allocate (extended_type :: a(2)) tmp%i=a%i end I think the problem is in the allocate statement: a._data.data = (void * restrict) __builtin_malloc (8); The allocation size seems to be independent of whether one allocates with "base_type" or "extended type".