public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/47586] New: allocatable components: deep copy missing
Date: Wed, 02 Feb 2011 14:09:00 -0000	[thread overview]
Message-ID: <bug-47586-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47586

           Summary: allocatable components: deep copy missing
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: janus@gcc.gnu.org


Follow-up to PR 47455 (comment #5):


  type :: tx
    integer, dimension(:), allocatable :: i
  end type tx

  type(tx) :: this
  type(tx), target :: that
  type(tx), pointer :: p
  allocate(that%i(2))
  that%i = [0, 0]
  p => that
!   this = that  ! (1) direct assignment: works (deep copy)
!   this = p     ! (2) using a pointer works as well
  this = find_x(that)  ! (3) pointer function: fails (deep copy missing)
  that%i = [1, 1]
  print *,this%i
  if(any (this%i /= [0, 0])) call abort()

contains

  function find_x(that)
    type(tx), target  :: that
    type(tx), pointer :: find_x
    find_x => that
  end function find_x

end



This code currently fails for the third case, while it works for the first two.


             reply	other threads:[~2011-02-02 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 14:09 janus at gcc dot gnu.org [this message]
2012-08-14 16:46 ` [Bug fortran/47586] [F03] " mikael at gcc dot gnu.org
2012-08-14 16:52 ` mikael 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=bug-47586-4@http.gcc.gnu.org/bugzilla/ \
    --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).