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/46321] [OOP] Polymorphic deallocation
Date: Thu, 08 Aug 2013 14:36:00 -0000	[thread overview]
Message-ID: <bug-46321-4-kFQSZEzNtu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46321-4@http.gcc.gnu.org/bugzilla/>

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from janus at gcc dot gnu.org ---
Indeed all the items from comment 1 to 3 seems to be handled. Below is a test
case, whose dump shows a _final call being created for all of them.

The only exception is realloc-on-assignment, which is not implemented yet for
CLASS variables, but there is PR 43366 to track that.

Therefore this PR can be closed, I think.



program p

type t
end type t

type u
  class(t), allocatable :: c
end type

class(t), allocatable :: a,b
type(u), allocatable :: uu
integer :: i
character(len=100) :: str

allocate(a,b,uu)

! (1) explicit deallocation
deallocate(a)

! (4) STAT and ERRMSG
deallocate(a,stat=i,errmsg=str)
if (i/=0) print *,i,str

! (5) dealloc of comp.
deallocate(uu)

! (6) move_alloc
call move_alloc(b,a)

contains

  subroutine out (x)
    ! (2) intent(out)
    class(t), intent(out) :: x
  end subroutine

  subroutine sub ()
    ! (3) out of scope
    class(t), allocatable :: local
    allocate(local)
  end subroutine

end


      parent reply	other threads:[~2013-08-08 14:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-05 18:37 [Bug fortran/46321] New: " janus at gcc dot gnu.org
2010-11-05 21:02 ` [Bug fortran/46321] " burnus at gcc dot gnu.org
2011-02-09 14:03 ` burnus at gcc dot gnu.org
2011-02-21 15:11 ` janus at gcc dot gnu.org
2011-11-26 14:33 ` burnus at gcc dot gnu.org
2012-01-29 14:37 ` burnus at gcc dot gnu.org
2012-05-07  9:34 ` sfilippone at uniroma2 dot it
2012-05-07  9:51 ` janus at gcc dot gnu.org
2013-07-22  7:31 ` janus at gcc dot gnu.org
2013-08-08 14:36 ` janus at gcc dot gnu.org [this message]

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-46321-4-kFQSZEzNtu@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).