public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44047]  New: [OOP] SELECT TYPE with associate-name and allocatable selector
@ 2010-05-09  9:35 janus at gcc dot gnu dot org
  2010-08-25 16:33 ` [Bug fortran/44047] " domob at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-09  9:35 UTC (permalink / raw)
  To: gcc-bugs

The following test case is a modified version of the one in
http://gcc.gnu.org/ml/fortran/2009-10/msg00047.html:

implicit none
type t0
 integer :: j = 42
end type t0
type t
 integer :: i
 class(t0), allocatable :: foo
end type t
type(t) :: m
allocate(t0 :: m%foo)
m%i = 5
select type(bar => m%foo)
type is(t0)
 print *, bar
end select
end

While the original version (using allocatable CLASS arrays) still ICEs, this
one here compiles cleanly, but gives a "double free" runtime error.

The reason for this error is that we generate a local temporary for "bar",
which is auto-deallocated at the end of the SELECT TYPE block, so that the
auto-deallocation of "m%foo" fails.

The auto-deallocation of "bar" should not happen, i.e. "bar" should not have
the ALLOCATABLE attribute (currently the dump shows "struct .class.t0.a bar").


-- 
           Summary: [OOP] SELECT TYPE with associate-name and allocatable
                    selector
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org


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


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

end of thread, other threads:[~2010-08-26 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-09  9:35 [Bug fortran/44047] New: [OOP] SELECT TYPE with associate-name and allocatable selector janus at gcc dot gnu dot org
2010-08-25 16:33 ` [Bug fortran/44047] " domob at gcc dot gnu dot org
2010-08-26 19:50 ` domob at gcc dot gnu dot org
2010-08-26 19:52 ` domob at gcc dot gnu dot 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).