From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21005 invoked by alias); 13 Jul 2007 09:50:59 -0000 Received: (qmail 20960 invoked by uid 48); 13 Jul 2007 09:50:48 -0000 Date: Fri, 13 Jul 2007 09:50:00 -0000 Message-ID: <20070713095048.20959.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/32665] allocatable array on lhs deleted while still in use on rhs In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pault at gcc dot gnu dot org" 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: 2007-07/txt/msg01483.txt.bz2 ------- Comment #2 from pault at gcc dot gnu dot org 2007-07-13 09:50 ------- This is a two-in-oner; as well as the deallocation, this is broken: $ cat pr32665.f90 TYPE :: x INTEGER, ALLOCATABLE :: a(:) END TYPE TYPE(x) :: a, b call foo b = x((/ (a%a), 4 /)) print *, "foo gives ", b%a call bar b = x((/ (a%a), 4 /)) print *, "bar gives ", b%a contains subroutine foo allocate (a%a(2)) a%a(1) = 1 a%a(2) = 2 end subroutine subroutine bar a = x ((/1, 2/)) end subroutine end $ ./a foo gives 1 2 4 bar gives 1 2 0 4 This comes about because the structure constructor suddenly runs amok, with: parm.2.data = 0B; x.0.a.offset = 0; x.0.a.dim[0].ubound = x.0.a.dim[0].ubound + 1; x.0.a.dim[0].lbound = 1; D.1014 = x.0.a.dim[0].lbound * x.0.a.dim[0].stride; x.0.a.offset = x.0.a.offset - D.1014; } a = x.0; *sigh* Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32665