http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207



--- Comment #1 from janus at gcc dot gnu.org 2012-11-04 18:32:29 UTC ---

Patch:



Index: gcc/fortran/trans-decl.c

===================================================================

--- gcc/fortran/trans-decl.c    (revision 193135)

+++ gcc/fortran/trans-decl.c    (working copy)

@@ -3771,9 +3771,10 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gf

           else

         gfc_restore_backend_locus (&loc);



-          /* Deallocate when leaving the scope. Nullifying is not

-         needed.  */

-          if (!sym->attr.result && !sym->attr.dummy)

+          /* Automatic deallocation when leaving the scope.

+         Nullifying is not needed.  */

+          if (!proc_sym->attr.is_main_program

+          && !sym->attr.result && !sym->attr.dummy)

         {

           if (sym->ts.type == BT_CLASS

               && CLASS_DATA (sym)->attr.codimension)







This regresses on:



FAIL: gfortran.dg/allocatable_scalar_9.f90  -O0   scan-tree-dump-times original

"__builtin_free" 32

FAIL: gfortran.dg/coarray_lib_alloc_2.f90  -O   scan-tree-dump-times original

"_gfortran_caf_deregister .&yy._data.token, 0B, 0B, 0.;" 1

FAIL: gfortran.dg/move_alloc_4.f90  -O0   scan-tree-dump-times original

"__builtin_free" 9

Reply via email to