[Bug fortran/40850] double free in nested types with allocatable components

dfranke at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Dec 6 18:15:00 GMT 2009



------- Comment #4 from dfranke at gcc dot gnu dot org  2009-12-06 18:15 -------
Reduced testcase:

  type t1
    integer, allocatable :: d1(:)
  end type t1
  type t2
    type(t1), allocatable :: d2(:)
  end type t2
  type(t2) :: a, b

  a = new2( (/ new1((/1,1/)) /) )
  b = new2( (/ a%d2 , a%d2 /) )

contains
  pure type(t1) function new1(d1)
    integer, intent(in) :: d1(:)
    allocate(new1%d1(size(d1)))
    new1%d1 = d1
  end function
  pure type(t2) function new2(d2)
    type(t1), intent(in) :: d2(:)
    allocate(new2%d2(size(d2)))
    new2%d2 = d2
  end function
end

The dump still has about 800 lines - somewhat hard to tell what's going on.
Adding PaulT as CC.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org, pault at gcc dot gnu
                   |                            |dot org
   Last reconfirmed|2009-07-25 07:32:47         |2009-12-06 18:15:24
               date|                            |
            Summary|"double free or corruption" |double free in nested types
                   |returning derived types with|with allocatable components
                   |allocatable components      |


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



More information about the Gcc-bugs mailing list