public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/35824] Overloading problems with derived type with allocatable array
Date: Sun, 18 May 2008 15:38:00 -0000	[thread overview]
Message-ID: <20080518153744.1472.qmail@sourceware.org> (raw)
In-Reply-To: <bug-35824-16016@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from pault at gcc dot gnu dot org  2008-05-18 15:37 -------
> I have to admit, I did not quickly see in the dump (-fdump-tree-original) why
> it is failing; at a glance, both calling "neg_at" in MAIN__ and the assignment
> in "neg_at" itself look ok; and "t2 = -t1" also works.

The reason is that the lhs is deallocated and nulled before the assignment:

    if (t1.b.data != 0B)
      {
        __builtin_free (t1.b.data);
      }
    t1.b.data = 0B;
    D.722 = neg_at (&t1);
    at_from_at (&t1, &D.722);
    if (D.722.b.data != 0B)
      {
        __builtin_free (D.722.b.data);
      }
    D.722.b.data = 0B;
  }

Thus a data null is passed to the neg_at.

If the operator assignment is deleted, so that we rely on the intrinsic
assignment for derived types with allocatable components, the correct result is
obtained:

    D.719 = t2;
    t2 = neg_at (&t1);
    if (D.719.b.data != 0B)
      {
        __builtin_free (D.719.b.data);
      }
    D.719.b.data = 0B;

I'll have to see how that can be emulated.

Paul


-- 


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


  parent reply	other threads:[~2008-05-18 15:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-04  9:19 [Bug fortran/35824] New: " everyo at gmx dot net
2008-04-04 10:10 ` [Bug fortran/35824] " dominiq at lps dot ens dot fr
2008-04-04 14:15 ` burnus at gcc dot gnu dot org
2008-05-18 15:38 ` pault at gcc dot gnu dot org [this message]
2008-05-18 16:01 ` pault at gcc dot gnu dot org
2008-11-30  8:05 ` pault at gcc dot gnu dot org
2008-11-30  8:51 ` pault at gcc dot gnu dot 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=20080518153744.1472.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).