program boh
!
call mah (0)
call mah (1)
call mah (2)
!
end program boh
!
subroutine mah (i)
!
integer, intent(in) :: i
!
type mix_type
real(8), allocatable :: a(:)
complex(8), allocatable :: b(:)
end type mix_type
type(mix_type), allocatable, save :: t(:)
integer :: j, n=1024
!
if (i==0) then
allocate (t(1))
allocate (t(1)%a(n))
allocate (t(1)%b(n))
do j=1,n
t(1)%a(j) = j
t(1)%b(j) = n-j
end do
end if
c = sum( t(1)%a(:) ) + sum( t(1)%b(:) )
print *, 'c=',c
if ( i==2) then
deallocate (t(1)%b)
deallocate (t(1)%a)
deallocate (t)
end if
end subroutine mah
Maybe you will find this piece of code a perversion, but it looks
correct to me (I am not a big f90 expert). At the second call of
subroutine mah, it coredumps. It works if the array t(1) is
replaced by a single variable t. It works with g95. I haven't
access right now to any other machine with recent versions
of gfortran so I cannot say whether it is OS-X specific or not.
Best regards
Paolo
---
Paolo Giannozzi, Dept of Physics, University of Udine
via delle Scienze 208, 33100 Udine, Italy
Phone +39-0432-558216, fax +39-0432-558222