From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32427 invoked by alias); 25 Jul 2007 05:20:32 -0000 Received: (qmail 32382 invoked by uid 48); 25 Jul 2007 05:20:21 -0000 Date: Wed, 25 Jul 2007 05:20:00 -0000 Message-ID: <20070725052021.32381.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/32880] User operator & allocatable TYPE components: wrong deallocate In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pault at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-07/txt/msg02539.txt.bz2 ------- 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