public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/55207] Automatic deallocation of variables declared in the main program
Date: Sun, 04 Nov 2012 18:32:00 -0000	[thread overview]
Message-ID: <bug-55207-4-DBOA4RZIIu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55207-4@http.gcc.gnu.org/bugzilla/>


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	other threads:[~2012-11-04 18:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-04 18:27 [Bug fortran/55207] New: " janus at gcc dot gnu.org
2012-11-04 18:32 ` janus at gcc dot gnu.org [this message]
2012-11-04 22:27 ` [Bug fortran/55207] " janus at gcc dot gnu.org
2012-11-04 22:48 ` janus at gcc dot gnu.org
2012-11-05  9:07 ` janus at gcc dot gnu.org
2012-11-05  9:37 ` janus at gcc dot gnu.org
2012-11-05 17:45 ` janus at gcc dot gnu.org
2013-07-22 11:01 ` janus at gcc dot gnu.org
2013-07-31 20:43 ` janus at gcc dot gnu.org
2013-08-01 14:58 ` janus at gcc dot gnu.org
2013-08-01 15:02 ` janus at gcc dot gnu.org
2013-08-06  8:29 ` janus at gcc dot gnu.org
2013-12-18 11:46 ` [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute janus at gcc dot gnu.org
2014-03-15 10:53 ` janus at gcc dot gnu.org
2014-03-15 11:12 ` dominiq at lps dot ens.fr
2014-03-15 12:14 ` janus at gcc dot gnu.org
2014-03-18 22:15 ` janus at gcc dot gnu.org
2014-03-18 22:23 ` janus at gcc dot gnu.org
2015-10-21 10:32 ` jb at gcc dot gnu.org
2023-03-18 17:40 ` pault at gcc dot gnu.org
2023-03-18 17:40 ` pault at gcc dot gnu.org
2023-05-02 13:23 ` burnus at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55207-4-DBOA4RZIIu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).