[Patch, Fortran] Enable FINALization/poly dealloc for allocatables

Tobias Burnus burnus@net-b.de
Thu May 30 10:25:00 GMT 2013


Small update of the patch. Changes:

* There was a problem finalizing  "var(:)%comp", which lead to an ICE. 
Thanks to Dominique pointed out. See "expr->rank =" code added in 
gfc_add_finalizer_call. I added the full test case from PR37336 (dg-do 
compile: finalize_14.f90) to test for this.

* I added a new test case, which ensures that the built-in scalarizer 
and packer works correctly (it did), see finalize_13.f90.

The latter test case depends on the patch posted at: 
http://gcc.gnu.org/ml/fortran/2013-05/msg00114.html
[As Domique has pointed out, I forgot to change the allocate back to "t2 
::" in that test case. I will do so before committal (and change the 
malloc check to "(40)".)]


OK for the trunk?

Tobias


Tobias Burnus wrote:
> this patch enables finalization (and polymorphic deallocation) for 
> allocatables for: end of scope, DEALLOCATE and intent(out).
>
> As a side effect, an allocatable is no longer deallocated at the end 
> of the main program. (Variables declared in the main program have 
> automatically SAVE attribute; before finalization, it made no 
> difference but with finalization it is detectable. And only finalizing 
> nonfinalizable allocatables seems to be too much effort for too little 
> gain.)
...
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?
>
> Tobias
>
> PS: Fortran requires additional cases where finalization has to 
> happen; those will be added in follow-up patches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: finalize-alloc-v2.diff
Type: text/x-patch
Size: 39088 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130530/1f572a5a/attachment.bin>


More information about the Fortran mailing list