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/32880] User operator & allocatable TYPE components: wrong deallocate
Date: Wed, 25 Jul 2007 05:20:00 -0000	[thread overview]
Message-ID: <20070725052021.32381.qmail@sourceware.org> (raw)
In-Reply-To: <bug-32880-13404@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from pault at gcc dot gnu dot org  2007-07-25 05:20 -------
Another sub-pr: putting the res on the rhs in parentheses does not work either.
 This can be fixed by...

$ svn diff -x -cp gcc/fortran/trans-expr.c
Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c    (revision 126885)
--- gcc/fortran/trans-expr.c    (working copy)
*************** gfc_conv_variable (gfc_se * se, gfc_expr
*** 472,477 ****
--- 472,482 ----
                  || sym->attr.result))
            se->expr = build_fold_indirect_ref (se->expr);

+         /* A character with VALUE attribute needs an address
+            expression.  */
+         if (sym->attr.value)
+           se->expr = build_fold_addr_expr (se->expr);
+
        }
        else if (!sym->attr.value)
        {
*************** gfc_conv_expr_op (gfc_se * se, gfc_expr
*** 1044,1049 ****
--- 1049,1064 ----
      case INTRINSIC_UPLUS:
      case INTRINSIC_PARENTHESES:
        gfc_conv_expr (se, expr->value.op.op1);
+
+       if (expr->value.op.op1->ts.type == BT_DERIVED
+           && expr->value.op.op1->ts.derived->attr.alloc_comp)
+       {
+         tmp = gfc_evaluate_now (se->expr, &se->pre);
+         type = gfc_copy_alloc_comp (expr->value.op.op1->ts.derived, se->expr,
tmp, 0);
+         se->expr = tmp;
+         gfc_add_expr_to_block (&se->pre, type);
+       }
+
        return;

leading to a dependency check which puts res in parentheses for the primary
problem.

Paul


-- 


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


  parent reply	other threads:[~2007-07-25  5:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24 15:56 [Bug fortran/32880] New: " burnus at gcc dot gnu dot org
2007-07-24 16:20 ` [Bug fortran/32880] " burnus at gcc dot gnu dot org
2007-07-24 19:57 ` pault at gcc dot gnu dot org
2007-07-25  5:20 ` pault at gcc dot gnu dot org [this message]
2007-07-27 17:35 ` patchapp at dberlin dot org
2007-07-28  5:29 ` pault at gcc dot gnu dot org
2007-07-28  5:30 ` 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=20070725052021.32381.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).