[Patch, Fortran] PR 42647: Missed initialization/dealloc of allocatable scalar DT with allocatable component
Tobias Burnus
burnus@net-b.de
Thu Oct 14 20:44:00 GMT 2010
Janus Weil wrote:
> 2010/10/13 Tobias Burnus<burnus@net-b.de>:
>> I have not yet had a closer look at the patch, but I think you should
>> also take care of the DEALLOCATE statement. Example: [...]
> Yes, you're right. I need to restructure my patch a bit to make it
> work also for DEALLOCATE.
>
>> In any case the following program leaks memory (without the "if" line);
> This is fixed by the following hunk: [....]
Thanks - it fixes my test case and the one of PR 42647 comment 10 (after
fixing the test-case bug).
Though after modifying my test a bit, it still fails. Thus, if you are
looking for a failing test case with DEALLOCATE: The following crashes
here with a segfault.
type t
integer, allocatable :: p
end type t
type(t), allocatable :: a
allocate(a)
allocate(a%p)
deallocate(a, stat=istat)
if(istat /= 0) call abort()
deallocate(a, stat=istat) ! << segfault
if(istat == 0) call abort()
end
Tobias
More information about the Fortran
mailing list