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/49466] [4.6/4.7 Regression] Memory leak with assignment of extended derived types
Date: Mon, 27 Jun 2011 17:33:00 -0000 [thread overview]
Message-ID: <bug-49466-4-Bh497VEeJV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49466-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49466
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
--- Comment #8 from janus at gcc dot gnu.org 2011-06-27 17:33:19 UTC ---
(In reply to comment #7)
> This is due to revision 165973:
... and fixed by a partial revert of this commit (see below), which is free of
testsuite regressions. Will commit as obvious soon (unfortunately too late for
the 4.6.1 release).
Index: gcc/testsuite/gfortran.dg/allocatable_scalar_9.f90
===================================================================
--- gcc/testsuite/gfortran.dg/allocatable_scalar_9.f90 (revision 175536)
+++ gcc/testsuite/gfortran.dg/allocatable_scalar_9.f90 (working copy)
@@ -49,7 +49,7 @@ if(allocated(na3%b3)) call abort()
if(allocated(na4%b4)) call abort()
end
-! { dg-final { scan-tree-dump-times "__builtin_free" 32 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_free" 38 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
! { dg-final { cleanup-modules "m" } }
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c (revision 175536)
+++ gcc/fortran/trans-array.c (working copy)
@@ -6682,18 +6682,22 @@ structure_alloc_comps (gfc_symbol * der_type, tree
switch (purpose)
{
case DEALLOCATE_ALLOC_COMP:
+ if (cmp_has_alloc_comps && !c->attr.pointer)
+ {
+ /* Do not deallocate the components of ultimate pointer
+ components. */
+ comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+ decl, cdecl, NULL_TREE);
+ rank = c->as ? c->as->rank : 0;
+ tmp = structure_alloc_comps (c->ts.u.derived, comp, NULL_TREE,
+ rank, purpose);
+ gfc_add_expr_to_block (&fnblock, tmp);
+ }
+
if (c->attr.allocatable && c->attr.dimension)
{
comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
- if (cmp_has_alloc_comps && !c->attr.pointer)
- {
- /* Do not deallocate the components of ultimate pointer
- components. */
- tmp = structure_alloc_comps (c->ts.u.derived, comp, NULL_TREE,
- c->as->rank, purpose);
- gfc_add_expr_to_block (&fnblock, tmp);
- }
tmp = gfc_trans_dealloc_allocated (comp);
gfc_add_expr_to_block (&fnblock, tmp);
}
next prev parent reply other threads:[~2011-06-27 17:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-19 0:43 [Bug fortran/49466] New: " townsend at astro dot wisc.edu
2011-06-19 15:28 ` [Bug fortran/49466] " janus at gcc dot gnu.org
2011-06-19 15:40 ` townsend at astro dot wisc.edu
2011-06-19 15:51 ` dominiq at lps dot ens.fr
2011-06-19 17:52 ` [Bug fortran/49466] [4.6/4.7 Regression] " janus at gcc dot gnu.org
2011-06-19 18:45 ` dominiq at lps dot ens.fr
2011-06-19 18:58 ` townsend at astro dot wisc.edu
2011-06-20 6:21 ` dominiq at lps dot ens.fr
2011-06-27 17:33 ` janus at gcc dot gnu.org [this message]
2011-06-27 20:59 ` janus at gcc dot gnu.org
2011-07-02 13:46 ` janus at gcc dot gnu.org
2011-07-02 13:52 ` janus 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-49466-4-Bh497VEeJV@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).