This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Sep 2010 14:49:05 -0000
- Subject: [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
- References: <bug-42647-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from dominiq at lps dot ens dot fr 2010-09-02 14:49 -------
The tests in the different comments seem to pass since some time.
The behavior of the derived test
module m
type st
integer , allocatable :: c1
end type st
type t1
type(st), allocatable :: b1
end type t1
end module m
use m
type(t1) :: a1, aa1(:)
allocatable :: a1, aa1
if(allocated(a1)) call abort()
if(allocated(aa1)) call abort()
print *, 'now allocate'
allocate(a1, a1%b1, a1%b1%c1)
print *, allocated(a1), allocated(a1%b1), allocated(a1%b1%c1)
a1%b1%c1 = 1
print *, a1%b1%c1
deallocate(a1%b1%c1)
print *, allocated(a1), allocated(a1%b1), allocated(a1%b1%c1)
deallocate(a1%b1)
end
has changed with r163744. Before one got
[macbook] f90/bug% a.out
now allocate
Segmentation fault
Now I get:
[macbook] f90/bug% a.out
now allocate
T T T
1
T T F
At line 25 of file pr42647_1_pass_1_red_1.f90
Fortran runtime error: Attempt to DEALLOCATE unallocated 'a1'
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647