From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17612 invoked by alias); 3 Sep 2010 12:12:58 -0000 Received: (qmail 17477 invoked by uid 48); 3 Sep 2010 12:12:26 -0000 Date: Fri, 03 Sep 2010 12:12:00 -0000 Message-ID: <20100903121226.17476.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/45516] [F08] allocatable compontents of recursive type In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus 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: 2010-09/txt/msg00434.txt.bz2 ------- Comment #2 from burnus at gcc dot gnu dot org 2010-09-03 12:12 ------- (In reply to comment #1) > Here is a patch to accept the type declaration in comment #0: Well, you at least need to use gfc_notify_std(GFC_STD_F2008, ... And one should make sure that the allocation/clean up works as expected. * * * As follow up to the initial implementation, one should implement at some point the following, which does not do a deep copy but simply appends the old data. (Example from the mentioned article.) type entry real :: value integer :: index type(entry), allocatable :: next end type entry type (entry), allocatable :: top top = entry ( new_value, new_index, top ) (The last line assume reallocate on assignment; I think it already works for derived types with structure constructor; I know that it does not yet work for intrinsic types - not does it work on other assignment than structure constructors.) The classical way to append a new item is the following, which should avoid a deep copy (check!): type (entry), allocatable :: top, temp temp = entry ( new_value, new_index, temp ) call move_alloc(top,temp%next) call move_alloc(temp,top) -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |domob at gcc dot gnu dot | |org, burnus at gcc dot gnu | |dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45516