Comments

And another one: I just realized that the following dead code can be
removed (twice):
+ if (TREE_CODE (array) == ADDR_EXPR
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (array, 0))))
+ tmp = TREE_OPERAND (array, 0);
As "tmp" is not used. That's part of gfc_build_final_call,thus, I cannot
easily do it as follow up patch.
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
Tobias Burnus wrote:
> Another re-diff.>> Changes:> - Removed spurious bits of the now-committed patch, > http://gcc.gnu.org/ml/fortran/2013-05/msg00114.html> - Moved gfc_build_final_call up in the file and made it static.> - Removed it from trans.h. Instead, gfc_add_finalizer_call is now > nonstatic.>> The reason for the latter change is that I want to use it for > INTENT(OUT) finalization for nonallocatables - and including the > change in this patch makes life easier for me.>> OK for the trunk?>> Tobias>> Tobias Burnus wrote:>> 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.> [...]>> 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.