------- Comment #2 from pault at gcc dot gnu dot org  2007-07-13 09:50 -------
This is a two-in-oner; as well as the deallocation, this is broken:

$ cat pr32665.f90
  TYPE :: x
    INTEGER, ALLOCATABLE :: a(:)
  END TYPE
  TYPE(x) :: a, b
  call foo
  b = x((/ (a%a), 4 /))
  print *, "foo gives ", b%a
  call bar
  b = x((/ (a%a), 4 /))
  print *, "bar gives ", b%a
contains
  subroutine foo
    allocate (a%a(2))
    a%a(1) = 1
    a%a(2) = 2
  end subroutine
  subroutine bar
    a = x ((/1, 2/))
  end subroutine
end

$ ./a
 foo gives            1           2           4
 bar gives            1           2           0           4

This comes about because the structure constructor suddenly runs amok, with:

    parm.2.data = 0B;
    x.0.a.offset = 0;
    x.0.a.dim[0].ubound = x.0.a.dim[0].ubound + 1;
    x.0.a.dim[0].lbound = 1;
    D.1014 = x.0.a.dim[0].lbound * x.0.a.dim[0].stride;
    x.0.a.offset = x.0.a.offset - D.1014;
  }
  a = x.0;

*sigh*

Paul


-- 


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

Reply via email to