public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45516] [F08] allocatable compontents of recursive type
Date: Fri, 03 Sep 2010 12:12:00 -0000	[thread overview]
Message-ID: <20100903121226.17476.qmail@sourceware.org> (raw)
In-Reply-To: <bug-45516-16146@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2010-09-03 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  9:57 [Bug fortran/45516] New: " janus at gcc dot gnu dot org
2010-09-03  9:59 ` [Bug fortran/45516] " janus at gcc dot gnu dot org
2010-09-03 12:12 ` burnus at gcc dot gnu dot org [this message]
     [not found] <bug-45516-4@http.gcc.gnu.org/bugzilla/>
2011-02-03 22:03 ` janus at gcc dot gnu.org
2011-02-06 12:36 ` janus at gcc dot gnu.org
2011-02-06 13:02 ` janus at gcc dot gnu.org
2012-08-29  9:18 ` burnus at gcc dot gnu.org
2020-10-21 12:39 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100903121226.17476.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).