public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/40851] problem with deallocation of pointers
Date: Sat, 25 Jul 2009 06:56:00 -0000	[thread overview]
Message-ID: <20090725065547.9289.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40851-15192@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from burnus at gcc dot gnu dot org  2009-07-25 06:55 -------
CONFIRM. Affects all GCC with pointer intent (4.3/4.4/4.5). For

  subroutine set_ptr (ptr)
    type(string_container), pointer, intent(out) :: ptr

one shall not deallocate the pointer. The pointer intent is different from a
non-pointer intent:


set_ptr (struct string_container * & ptr)
{
  if (ptr != 0)
    {
      if (ptr->string.chars.data != 0B)
        {
          __builtin_free (ptr->string.chars.data);


Untested patch:

--- trans-decl.c        (Revision 150038)
+++ trans-decl.c        (Arbeitskopie)
@@ -2958,6 +3009,7 @@ init_intent_out_dt (gfc_symbol * proc_sy
   gfc_init_block (&fnblock);
   for (f = proc_sym->formal; f; f = f->next)
     if (f->sym && f->sym->attr.intent == INTENT_OUT
+         && !sym->attr.pointer
          && f->sym->ts.type == BT_DERIVED)
       {
        if (f->sym->ts.derived->attr.alloc_comp)
@@ -3708,6 +3760,7 @@ generate_local_decl (gfc_symbol * sym)
       if (!sym->attr.referenced
            && sym->ts.type == BT_DERIVED
            && sym->ts.derived->attr.alloc_comp
+           && !sym->attr.pointer
            && ((sym->attr.dummy && sym->attr.intent == INTENT_OUT)
                  ||
                (sym->attr.result && sym != sym->result)))


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-25 06:55:42
               date|                            |


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


  parent reply	other threads:[~2009-07-25  6:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24 20:03 [Bug fortran/40851] New: " juergen dot reuter at desy dot de
2009-07-24 20:05 ` [Bug fortran/40851] " juergen dot reuter at desy dot de
2009-07-25  6:56 ` burnus at gcc dot gnu dot org [this message]
2009-07-25 19:14 ` burnus at gcc dot gnu dot org
2009-07-27  9:32 ` burnus at gcc dot gnu dot org
2009-07-27  9:33 ` [Bug fortran/40851] [4.3/4.4] " burnus at gcc dot gnu dot org
2009-07-29  9:35 ` burnus at gcc dot gnu dot org
2009-08-16 20:29 ` [Bug fortran/40851] [4.3/4.4/4.5] " burnus at gcc dot gnu dot org
2009-08-16 20:29 ` [Bug fortran/40851] [4.3] " burnus at gcc dot gnu dot org
2009-08-16 20:52 ` [Bug fortran/40851] [4.3/4.4/4.5] " steven at gcc dot gnu dot org
2009-08-16 21:37 ` rguenth at gcc dot gnu dot org
2009-08-23 11:09 ` mikpe at it dot uu dot se
2009-08-23 16:01 ` burnus at gcc dot gnu dot org
2009-08-23 16:02 ` burnus at gcc dot gnu dot org
2009-08-23 16:53 ` mikpe at it dot uu dot se

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=20090725065547.9289.qmail@sourceware.org \
    --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).