public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47586] New: allocatable components: deep copy missing
@ 2011-02-02 14:09 janus at gcc dot gnu.org
  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
  0 siblings, 2 replies; 3+ messages in thread
From: janus at gcc dot gnu.org @ 2011-02-02 14:09 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-14 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-02 14:09 [Bug fortran/47586] New: allocatable components: deep copy missing janus at gcc dot gnu.org
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

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