------- Comment #2 from dfranke at gcc dot gnu dot org  2007-07-18 17:12 -------
In the code below, X%I is set to 0B, although the data should be still
available:

$> cat pr32795.f90
  type :: a
    integer, allocatable :: i(:)
  end type a
  type(a) :: x, y

  x = a ((/ 1,2,3 /))
  y = a (x%i(:))         ! memory leak
  print *, "<", x%i, ">"
end

$> gfortran-svn -fdump-tree-original pr31320.f90 && ./a.out
 <>

The dump shows:
    x.i.data = 0B;
before the print statement. An attempt to dealloc x afterwards follows (thus
the leak).

I will see whether I can do anything. If anyone beats me to, be welcome.
Added Paul as CC.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-18 17:12:34
               date|                            |
            Summary|Leaking memory (generated   |[4.3 regression] allocatable
                   |prog) with type constructor |components are nullified
                   |& allocatable components    |prematurely


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

Reply via email to